<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/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/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>NRF9E5 read string from UART</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15117/nrf9e5-read-string-from-uart</link><description>Hello!
I need to read a string from UART, there&amp;#39;s code below: 
 unsigned char GetChar(void)
{
 while(!RI)
 ;
 RI = 0;
 return SBUF;
}

int Readfstr(void)
{
 char first_s, last_s;
 unsigned short int i=0;
 first_s = GetChar();
 if (first_s</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jul 2016 06:35:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15117/nrf9e5-read-string-from-uart" /><item><title>RE: NRF9E5 read string from UART</title><link>https://devzone.nordicsemi.com/thread/57725?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2016 06:35:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f7d729a-4203-4974-b427-178fafe3b15d</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;You should clear RI before the while loop in GetChar. The REN bit should also be set before clearing RI, and cleared after the while loop.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9E5 read string from UART</title><link>https://devzone.nordicsemi.com/thread/57724?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2016 14:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cf8092e8-c911-453c-a29c-d103462e93d5</guid><dc:creator>Lockdog</dc:creator><description>&lt;p&gt;Thanks for the reply. Yes, sure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF9E5 read string from UART</title><link>https://devzone.nordicsemi.com/thread/57723?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2016 12:17:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2da71f5-3ec8-48ac-a368-5a2a1d03d3c8</guid><dc:creator>&amp;#216;yvind Karlsen</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Have you set port 01 and 02 to RXD and TXD by writing?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;P0_ALT.1 = 1; //Set P01 to RXD
P0_ALT.2 = 1; //Set P02 to TXD
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The direction of UART RXD also depends on the setting of P0_DIR.1 (should be set to 1 for input).&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Øyvind&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>