<?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>UART</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/34640/uart</link><description> 
 I am new to ARM I have written a code for recieving the
character from UART then Display it on the LCD for LPC2148 but when i
run it in the proteus then LCD initialises correctly but when it
comes to receive data it continuously runs my code is as</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: UART</title><link>https://community.arm.com/thread/129029?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 12:05:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:058349e4-1184-430a-9c3f-8d2a47baa6d7</guid><dc:creator>Westonsupermare Pier</dc:creator><description>&lt;p&gt;&lt;p&gt;
Copy your original code out of the Keil IDE, don&amp;#39;t cut and paste
your first broken post. If it looks like nonsense in the &amp;quot;Preview&amp;quot;
it&amp;#39;s going to look like crap when you &amp;quot;Post&amp;quot; it.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART</title><link>https://community.arm.com/thread/120666?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 11:29:01 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4a6c5949-ce35-4398-b748-86b67792f50a</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
&amp;quot;my code is as Follows&amp;quot;&lt;/p&gt;

&lt;p&gt;
If that is what your code looks like, then I see big black clouds
over your house.&lt;/p&gt;

&lt;p&gt;
Wouldn&amp;#39;t it be much better if the code had some form of identation
and settled for just one command per line?&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;stdlib.h&amp;gt;

int main(void) {
    printf(&amp;quot;Hello World!\n&amp;quot;);
    return EXIT_SUCCESS;
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART</title><link>https://community.arm.com/thread/108443?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 10:28:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d29bc1fe-c02a-44d9-b4f7-9299b877011b</guid><dc:creator>Harib Suntar</dc:creator><description>&lt;p&gt;&lt;pre&gt;
&lt;i&gt;{ //U0TER=(1&amp;lt;&amp;lt;7); U0THR=x; while(!(U0LSR&amp;amp;(1&amp;lt;&amp;lt;5))); U0LSR=(1&amp;lt;&amp;lt;5);&lt;/i&gt;
&lt;/pre&gt;

&lt;p&gt;
WTF. You&amp;#39;ve commented out a whole line of code.&lt;/p&gt;

&lt;p&gt;
Lessons for a programmer:&lt;/p&gt;

&lt;p&gt;
1) Be precise&lt;br /&gt;
2) Be careful&lt;br /&gt;
3) Check&lt;br /&gt;
4) Don&amp;#39;t post stupid posts asking for help&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART</title><link>https://community.arm.com/thread/82800?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 10:04:48 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:07d6658b-9e14-4c03-8060-95814f39df82</guid><dc:creator>AMBUJ MAURYA</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;i&gt;&lt;br /&gt;
I am new to ARM I have written a code for recieving the character
from UART then Display it on the LCD for LPC2148 but when i run it in
the proteus then LCD initialises correctly but when it comes to
receive data it continuously running and whether i am writing any
thing on Terminal or not&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;my code is as Follows&lt;br /&gt;
&lt;br /&gt;&lt;/i&gt;&lt;/p&gt;

&lt;pre&gt;
&lt;i&gt;#include&amp;lt;lpc214x.h&amp;gt;

#define RS (1&amp;lt;&amp;lt;16)
#define RW (1&amp;lt;&amp;lt;17)
#define EN (1&amp;lt;&amp;lt;18)
#define data_pins (0xF&amp;lt;&amp;lt;19)

void UART0_init(void);
void UART0_TX(unsigned int x);
unsigned int UART0_RX(void);
void lcd_cmd(unsigned char d);
void lcd_data(unsigned char d);
void lcd_init(void);
void lcd_string(unsigned char *d);
void delay(void);

unsigned char s;

int main(void)
{ UART0_init(); IO0DIR|=RS|EN|RW|data_pins; IO0CLR|=RW; lcd_init(); lcd_string(&amp;quot;Initializng...&amp;quot;); while(1) { s=UART0_RX(); lcd_data(s); delay(); lcd_cmd(0xc0); //UART0_TX(s); }
} void UART0_init(void)
{ PINSEL0|=(1&amp;lt;&amp;lt;0)|(1&amp;lt;&amp;lt;2); U0LCR=(1&amp;lt;&amp;lt;0)|(1&amp;lt;&amp;lt;1)|(1&amp;lt;&amp;lt;7); U0DLM=0; U0DLL=0x4E; U0LCR=0x03; U0FCR=(1&amp;lt;&amp;lt;0);
} void UART0_TX(unsigned int x)
{ //U0TER=(1&amp;lt;&amp;lt;7); U0THR=x; while(!(U0LSR&amp;amp;(1&amp;lt;&amp;lt;5))); U0LSR=(1&amp;lt;&amp;lt;5);
} unsigned int UART0_RX(void)
{ unsigned int x; while(!(U0LSR&amp;amp;(1&amp;lt;&amp;lt;0))); x=U0RBR; U0LSR=(1&amp;lt;&amp;lt;0); return x;
} unsigned char usart_rx(void)
{ unsigned char d; while(!(U0LSR &amp;amp; 0x01)); d=U0RBR; return d;
} void lcd_init(void)
{ lcd_cmd(0x02); lcd_cmd(0x28); lcd_cmd(0x28); lcd_cmd(0x06); lcd_cmd(0x01); lcd_cmd(0x0E); lcd_cmd(0x80);
} void lcd_data(unsigned char d)
{ IO0CLR|=data_pins; IO0SET|=data_pins&amp;amp;(d&amp;lt;&amp;lt;15); IO0SET|=RS; IO0SET|=EN; delay(); IO0CLR|=EN;

IO0CLR|=data_pins; IO0SET|=data_pins&amp;amp;(d&amp;lt;&amp;lt;19); IO0SET|=EN; delay(); IO0CLR|=EN;
} void lcd_cmd(unsigned char d)
{ IO0CLR|=data_pins; IO0SET|=data_pins&amp;amp;(d&amp;lt;&amp;lt;15); IO0CLR|=RS; IO0SET|=EN; delay(); IO0CLR|=EN;

IO0CLR|=data_pins; IO0SET|=data_pins&amp;amp;(d&amp;lt;&amp;lt;19); IO0SET|=EN; delay(); IO0CLR|=EN;
} void lcd_string(unsigned char *d)
{ while(d!=&amp;#39;\0&amp;#39;) { lcd_data(*d); d++; }
} void delay(void)
{ int i,j; for(i=0;i&amp;lt;50;i++) { for(j=0;j&amp;lt;500;j++); }
}&lt;/i&gt;
&lt;/pre&gt;

&lt;p&gt;
&lt;i&gt;i think recieve function goes to recursion condition but how to
stop it i am unable to Find&lt;/i&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART</title><link>https://community.arm.com/thread/93552?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 09:25:23 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:29051a21-1e76-4e7f-a553-2d0d4bf80fb4</guid><dc:creator>edPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
But it was at least a bold attempt.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: UART</title><link>https://community.arm.com/thread/69361?ContentTypeID=1</link><pubDate>Tue, 15 Sep 2015 07:30:49 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8510c3b5-1e87-4833-859b-76057f1e6d9b</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Your source code is illegible because you didn&amp;#39;t follow the
instructions on how to post source code - they are quite clearly
stated, as this picture shows:&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://www.danlhenry.com/caps/keil_code.png"&gt;www.danlhenry.com/.../keil_code.png&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>