<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>serial communication</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/14830/serial-communication</link><description> I am using a Atmel AT89C51 and I am having trouble doing serial communication. Here is what I am trying: 
 
#include &amp;lt;AT89X51.H&amp;gt; 
#include &amp;lt;STDIO.H&amp;gt; 
#include &amp;lt;intrins.h&amp;gt; 
 
int i,j; 
 
void main() 
{ 
	PCON |= 0x00; /* don&amp;#39;t double baud rate */ 
	SCON</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: serial communication</title><link>https://community.arm.com/thread/84204?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2002 06:53:39 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:3b9dde8c-49aa-482f-8952-b9a66390c7c7</guid><dc:creator>Mark Odell</dc:creator><description>&lt;p&gt;You don&amp;#39;t need to set pins as output, they&amp;#39;re all pseudo-bidirectional. You write out to them an they&amp;#39;ll attempt to drive that level (port 0 is open drain so you&amp;#39;ll need a pull-up, actually, I often pull all my ports up). To read a port just write a one to the pin and then read it.&lt;br /&gt;
&lt;br /&gt;
For the UART and TxD the pin just works as an output, nothing for you to do. It&amp;#39;s not like the PIC.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: serial communication</title><link>https://community.arm.com/thread/54146?ContentTypeID=1</link><pubDate>Fri, 13 Sep 2002 05:21:28 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:fb44a9c6-1a3d-409c-84f3-75caef7579f8</guid><dc:creator>Niels Sejersen</dc:creator><description>&lt;p&gt;Im not an C51 expert, but I do not see a pin set as output anywhere. &lt;br /&gt;
&lt;br /&gt;
Best regards,&lt;br /&gt;
Niels&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: serial communication</title><link>https://community.arm.com/thread/38332?ContentTypeID=1</link><pubDate>Tue, 10 Sep 2002 12:51:30 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:506390db-3988-42a6-83a6-784655528b89</guid><dc:creator>Mark Odell</dc:creator><description>&lt;p&gt;Start with my one file uart.c driver at my website. It&amp;#39;s free and debugged. Hope it helps.&lt;br /&gt;
&lt;br /&gt;
- Mark&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.embeddedfw.com" target="_blank"&gt;http://www.embeddedfw.com&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: serial communication</title><link>https://community.arm.com/thread/84205?ContentTypeID=1</link><pubDate>Sun, 08 Sep 2002 21:37:36 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c0386d39-7201-4491-9617-2940060d00a8</guid><dc:creator>Jonas</dc:creator><description>&lt;p&gt;I think it should add &lt;br /&gt;
&lt;br /&gt;
  PCON &amp;amp;=0x7F;&lt;br /&gt;
&lt;br /&gt;
  TMOD |=0x20; &lt;br /&gt;
&lt;br /&gt;
  to your init of Uart.&lt;br /&gt;
&lt;br /&gt;
  Good luck.&lt;br /&gt;
&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: serial communication</title><link>https://community.arm.com/thread/54144?ContentTypeID=1</link><pubDate>Tue, 05 Feb 2002 10:47:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:53b97953-a4b5-4d7e-a067-8c2360d93274</guid><dc:creator>Hummer Hatchette</dc:creator><description>&lt;p&gt;I just want to have a simple program to print something out using hyperterminal.  Also it would be nice to receive a character and echo it back.  I have been able to do this in assembly but I can&amp;#39;t get it to work in C.  Here is the latest code I have tried:&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;AT89X51.H&amp;gt; &lt;br /&gt;
#include &amp;lt;CTYPE.H&amp;gt;&lt;br /&gt;
#include &amp;lt;STDIO.H&amp;gt;&lt;br /&gt;
&lt;br /&gt;
int i;&lt;br /&gt;
&lt;br /&gt;
void main()&lt;br /&gt;
{&lt;br /&gt;
    SCON  = 0x50;		//SCON: mode 1, 8-bit UART, enable rcvr&lt;br /&gt;
    TMOD  = 0x20;      	//TMOD: timer 1, mode 2, 8-bit reload    &lt;br /&gt;
    TH1   = 0xFD;       //TH1:  reload value for 9600 baud @ 11.0592MHz &lt;br /&gt;
    TR1   = 1;          //TR1:  timer 1 run          &lt;br /&gt;
    TI    = 1;          //TI:   set TI to send first char of UART &lt;br /&gt;
&lt;br /&gt;
 while (1) &lt;br /&gt;
 {&lt;br /&gt;
    P1 ^= 0x01;     		    	&lt;br /&gt;
    printf (&amp;quot;\n\nHello World\n\n&amp;quot;); 	&lt;br /&gt;
	i = _getkey();&lt;br /&gt;
	putchar(&amp;#39;$&amp;#39;);&lt;br /&gt;
	putchar(i);	&lt;br /&gt;
 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Is there anything wrong with my code? Or is there something in how I am compiling?  I am confident my hardware is fine because I can get it to work in assembly.  Any help would be appreciated.  Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: serial communication</title><link>https://community.arm.com/thread/38331?ContentTypeID=1</link><pubDate>Thu, 31 Jan 2002 11:39:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:c502c377-5b3b-40ee-9a97-19b426648335</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;Precisely what trouble are you having?&lt;br /&gt;
&lt;br /&gt;
Please use the &lt;b&gt;&amp;amp;ltpre&amp;amp;gt&lt;/b&gt; and &lt;b&gt;&amp;amp;lt/pre&amp;amp;gt&lt;/b&gt; tags (as directed!) when posting code!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>