<?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>Recognising a received uart character</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/12594/recognising-a-received-uart-character</link><description>I&amp;#39;ve been having a little bit of an issue trying to parse UART data that I am receiving from an external device. 
 Where I&amp;#39;m having issues right now is comparing an incoming byte with a specific character. I&amp;#39;m looking for the &amp;#39;+&amp;#39; character, but I get</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Mar 2016 11:18:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/12594/recognising-a-received-uart-character" /><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47820?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 11:18:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78a61131-ae4a-44fa-865d-eb38380e336c</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;&lt;strong&gt;State Machines&lt;/strong&gt; can be helpful for parsing ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47811?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 11:06:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6096a68e-43a8-4a06-8b9b-627786e0a8e0</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;For parsing purpose there are different approaches - you can look for unique patterns (ex. + at the beginning of every message), fixed length etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47819?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:58:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:afd5f852-e161-441f-88b3-e6043510738c</guid><dc:creator>Sensors</dc:creator><description>&lt;p&gt;Yes. Yes I did.  I almost never deal with strings in C, I didn&amp;#39;t know that made a difference. Thanks Can you make a note in your original answer pointing that out and I&amp;#39;ll mark it as accepted.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47818?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:56:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d79e9e5-0468-4c0b-be24-313f2c715e52</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Didn&amp;#39;t you confuse  &amp;#39;+&amp;#39; with &amp;quot;+&amp;quot; ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47817?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:52:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80cdd943-2141-44e7-acbe-4f2ec8910115</guid><dc:creator>Sensors</dc:creator><description>&lt;p&gt;Wojtek, I did exactly what you told me to do. Only way I can get it to work is if I define &lt;code&gt;test&lt;/code&gt; as an array. The error is from the compiler, but the IDE gives me a warning saying I cannot initialise a type char with a type char[2].&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47816?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:50:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7967726-4142-42f4-aa43-a4bb2865b15b</guid><dc:creator>Sensors</dc:creator><description>&lt;p&gt;The second part of my questions is a lot to do with the nordic SDK. I&amp;#39;m not really sure where/how I should parse the whole string. This string is of the form: &lt;code&gt;$FMS1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0&lt;/code&gt;, and I want to extract the first value out of it.&lt;/p&gt;
&lt;p&gt;How do I manage the UART/FIFO to help me do this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47815?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:49:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:565410b7-ed4e-4d80-a0a8-2ae9f55ad156</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;It gives you error because you did not do what I suggested :] and just like awneil said - its just c basics - you have to learn them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47814?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:47:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84a4a30b-d248-457d-a388-9225164e9ff8</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;Also, debugger is really easy to solve that kind of problems if you are confused with casts...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47813?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:47:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb2dd210-0006-4281-aa07-4900330cd515</guid><dc:creator>Sensors</dc:creator><description>&lt;p&gt;&lt;code&gt;error: #144: a value of type &amp;quot;char *&amp;quot; cannot be used to initialize an entity of type &amp;quot;char&amp;quot;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47812?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:46:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de659d7f-e77c-4e4c-bbef-6c7a9f173955</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Note that this is standard &amp;#39;C&amp;#39; stuff - nothing specifically to do with Nordic.&lt;/p&gt;
&lt;p&gt;Here are some &amp;#39;C&amp;#39; learning references &amp;amp; resources: &lt;a href="http://blog.antronics.co.uk/2011/08/08/so-youre-thinking-of-starting-with-c/"&gt;blog.antronics.co.uk/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Recognising a received uart character</title><link>https://devzone.nordicsemi.com/thread/47810?ContentTypeID=1</link><pubDate>Wed, 16 Mar 2016 10:38:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c9db932-2b92-47c6-abb0-ac5529d78fcd</guid><dc:creator>Wojtek</dc:creator><description>&lt;p&gt;You get l instead of + because you are comparing buffer[0] with pointer (casted to unsigned char), not with char. Just change: &lt;code&gt;char * test = &amp;quot;+&amp;quot;;&lt;/code&gt;  to &lt;code&gt;char test = &amp;#39;+&amp;#39;;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Note that &amp;quot;+&amp;quot; is not the same as &amp;#39;+&amp;#39; :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>