<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: LPC800-MAX and UART problem</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567529#M17552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Dilberto on Sun Mar 02 06:09:28 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, Cosik!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't analyzed your code in deep, but seems to me that the last code snippet may have an unintended precedence. Try this :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;( Note the added parentheses )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/* Wait until we're ready to send */
while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;2)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
LPC_USART1-&amp;gt;TXDATA = key;

while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;3)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:07:52 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:07:52Z</dc:date>
    <item>
      <title>LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567528#M17551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Cosik on Thu Feb 27 10:01:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just try to run UART on my LPC800-MAX, but it's didn't working. I think that I don't configure or set all necessary registers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here are my code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;uint8_t key;
uint32_t clk, i;
uint32_t baudRate = 115200;
const uint32_t UARTCLKDIV = 1;

/* Enable IOCON clock */
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1 &amp;lt;&amp;lt; 18);

/* Setup the clock and reset UART0 */
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1 &amp;lt;&amp;lt; 14)|(1 &amp;lt;&amp;lt; 15)|(1 &amp;lt;&amp;lt; 16);
LPC_SYSCON-&amp;gt;PRESETCTRL &amp;amp;= ~(1 &amp;lt;&amp;lt; 3);
LPC_SYSCON-&amp;gt;PRESETCTRL |= (1 &amp;lt;&amp;lt; 3);
LPC_SYSCON-&amp;gt;PRESETCTRL &amp;amp;= ~(1 &amp;lt;&amp;lt; 2);
LPC_SYSCON-&amp;gt;PRESETCTRL |= (1 &amp;lt;&amp;lt; 2);
NVIC_DisableIRQ(UART0_IRQn);

/* Enable the clock to the Switch Matrix */
LPC_SYSCON-&amp;gt;SYSAHBCLKCTRL |= (1 &amp;lt;&amp;lt; 7);

///* Pin Assign 8 bit Configuration */
///* U0_TXD */
///* U0_RXD */
//LPC_SWM-&amp;gt;PINASSIGN0 = 0xffff0004UL;
//
///* Pin Assign 1 bit Configuration */
///* SWCLK */
///* SWDIO */
///* RESET */
//LPC_SWM-&amp;gt;PINENABLE0 = 0xffffffb3UL;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Pin Assign 8 bit Configuration */
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* U1_TXD */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SWM-&amp;gt;PINASSIGN1 = 0xffff0fffUL;

&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Pin Assign 1 bit Configuration */
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SWCLK */
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* SWDIO */
&amp;nbsp;&amp;nbsp;&amp;nbsp; /* RESET */
&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SWM-&amp;gt;PINENABLE0 = 0xffffffb3UL;

LPC_SYSCON-&amp;gt;UARTCLKDIV = UARTCLKDIV;

/* Configure UART0 */
clk = __MAIN_CLOCK / UARTCLKDIV;
LPC_USART1-&amp;gt;CFG |= (1&amp;lt;&amp;lt;2);
LPC_USART1-&amp;gt;BRG = clk / 16 / baudRate - 1;
LPC_SYSCON-&amp;gt;UARTFRGDIV = 0xFF;
LPC_SYSCON-&amp;gt;UARTFRGMULT = (((clk / 16) * (LPC_SYSCON-&amp;gt;UARTFRGDIV + 1))
/ (baudRate * (LPC_USART1-&amp;gt;BRG + 1)))
- (LPC_SYSCON-&amp;gt;UARTFRGDIV + 1);

/* Clear the status bits */
LPC_USART1-&amp;gt;STAT = (1&amp;lt;&amp;lt;5) | (1&amp;lt;&amp;lt;11);

/* Enable UART0 */
LPC_USART1-&amp;gt;CFG |= (1&amp;lt;&amp;lt;0);

while (1)
{
for (key = 0x30; key &amp;lt;= 0x40; key++)
{
/* Wait until we're ready to send */
while (~LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;2))
;
LPC_USART1-&amp;gt;TXDATA = key;

while (~LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;3))
;
}
}&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could any one write me what is wrong with my code?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567528#M17551</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567529#M17552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Dilberto on Sun Mar 02 06:09:28 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, Cosik!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I haven't analyzed your code in deep, but seems to me that the last code snippet may have an unintended precedence. Try this :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;( Note the added parentheses )&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/* Wait until we're ready to send */
while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;2)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
LPC_USART1-&amp;gt;TXDATA = key;

while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;3)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567529#M17552</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567530#M17553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Cosik on Sun Mar 02 07:29:55 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I just resolved my problem, but I think partly. Problem was with optimization.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I used -O0 blinking LED was working, but program with USART not, but when I use -Os it's working without any changes in code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could anyone explain me why it happen?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567530#M17553</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567531#M17554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by TheFallGuy on Sun Mar 02 08:03:46 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;See this FAQ&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fcompiler-optimization" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization&lt;/A&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567531#M17554</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567532#M17555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Cosik on Sun Mar 02 13:32:20 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: TheFallGuy&lt;/STRONG&gt;&lt;BR /&gt;See this FAQ&lt;BR /&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.lpcware.com%2Fcontent%2Ffaq%2Flpcxpresso%2Fcompiler-optimization" rel="nofollow" target="_blank"&gt;http://www.lpcware.com/content/faq/lpcxpresso/compiler-optimization&lt;/A&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Yes, but there is information about "Optimized code fails to execute correctly". But I have inverted situation, optimized code is working good, and without optimization is not working.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567532#M17555</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567533#M17556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Mon Mar 03 01:11:57 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;What do you mean by "is not working"?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In cases like these you should look into the assembly code and compare it for the two optimization settings.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567533#M17556</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567534#M17557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Cosik on Mon Mar 03 01:21:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: starblue&lt;/STRONG&gt;&lt;BR /&gt;What do you mean by "is not working"?&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I mean, when i connect board do FT232 converter I can see in console output from uC.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567534#M17557</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567535#M17558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by noahk on Thu Mar 06 16:38:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: Dilberto&lt;/STRONG&gt;&lt;BR /&gt;Hi, Cosik!&lt;BR /&gt;&lt;BR /&gt;I haven't analyzed your code in deep, but seems to me that the last code snippet may have an unintended precedence. Try this :&lt;BR /&gt;( Note the added parentheses )&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/* Wait until we're ready to send */
while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;2)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
LPC_USART1-&amp;gt;TXDATA = key;

while (&amp;nbsp;&amp;nbsp; ~(&amp;nbsp;&amp;nbsp; LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;3)&amp;nbsp;&amp;nbsp; )&amp;nbsp;&amp;nbsp; )
;
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;Hope this helps.&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I prefer the other way (although for the example you gave, it doesn't matter):&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(~STAT &amp;amp; (...)) allows for multiple flags:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(~STAT &amp;amp; (1 &amp;lt;&amp;lt; 2 | 1 &amp;lt;&amp;lt; 3)); //wait for both. If either 1 &amp;lt;&amp;lt; 2 is low or 1 &amp;lt;&amp;lt; 3 is low in STAT, then the condition stays true and therefore waits. It only continues when both 1 &amp;lt;&amp;lt; 2 and 1 &amp;lt;&amp;lt; 3 are high in STAT.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(~(STAT &amp;amp; (1 &amp;lt;&amp;lt; 2 | 1 &amp;lt;&amp;lt; 3))); //will continue if either flag is 1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567535#M17558</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567536#M17559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by noahk on Thu Mar 06 16:52:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi Cosik,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you post your full project and code? Make sure to indicate if you are using a software library and which one (to make sure that any headers are identical).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567536#M17559</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567537#M17560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Fri Mar 07 01:59:07 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The loop condition by Dilberto is wrong, it will cause an endless loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the bit to be tested is zero then the complement will have all bits set, so the condition is true.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the bit is one then all other bits will be set and the condition is also true.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That said, I would write it like this (optimized for readability):&lt;/SPAN&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
while ((LPC_USART1-&amp;gt;STAT &amp;amp; (1&amp;lt;&amp;lt;2)) == 0)
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;SPAN&gt;I would also create constants for the flags.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567537#M17560</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: LPC800-MAX and UART problem</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567538#M17561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Cosik on Mon Mar 10 13:16:52 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;My project base on this one &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fgithub.com%2Fsebseb7%2Flpc8xx" rel="nofollow" target="_blank"&gt;https://github.com/sebseb7/lpc8xx&lt;/A&gt;&lt;SPAN&gt; a don't use any periph library, and have nothing more than i write. &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Read/write UART are from LPC8xx user manual.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:07:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC800-MAX-and-UART-problem/m-p/567538#M17561</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:07:57Z</dc:date>
    </item>
  </channel>
</rss>

