<?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>UART Interrupt mode undefined behaviour</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33845/uart-interrupt-mode-undefined-behaviour</link><description>Hi! 
 I&amp;#39;m running UART example and modified to run upon interrupt and its working fine, but in main() if condition ( if (cr == &amp;#39;q&amp;#39; || cr == &amp;#39;Q&amp;#39;) ) is not executing even condition is satisfied and it is printing q/Q upon sending through serially but not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 26 Apr 2018 13:38:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33845/uart-interrupt-mode-undefined-behaviour" /><item><title>RE: UART Interrupt mode undefined behaviour</title><link>https://devzone.nordicsemi.com/thread/129982?ContentTypeID=1</link><pubDate>Thu, 26 Apr 2018 13:38:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0046b21d-ee69-4578-b631-3213d3bf2144</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hey!&lt;br /&gt;&lt;br /&gt;It should work if you change the definition of &lt;strong&gt;data&lt;/strong&gt;&amp;nbsp;from &lt;em&gt;static&lt;/em&gt; to &lt;em&gt;volatile&lt;/em&gt;&amp;nbsp;as the value of &lt;strong&gt;data&lt;/strong&gt;&amp;nbsp;can be changed at any given time. Though be aware that the interrupt only handles inputs character by character so that&amp;nbsp;&lt;strong&gt;data&lt;/strong&gt;&amp;#39;s resulting value after writing for example &amp;#39;q&amp;#39; is &amp;#39;\n&amp;#39; (Newline). As the last character of the input is &amp;#39;\n&amp;#39; (Newline).&lt;/p&gt;
&lt;p&gt;I still got it to work with &amp;#39;q&amp;#39; and &amp;#39;Q&amp;#39;, but there could be limitations.&lt;/p&gt;
&lt;p&gt;- Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>