Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Parsing serial input

$
0
0

Hello All,

   I am using the Launchpad to read serial data from an instrument. Each reading from the instrument is  prefixed with the '~' character. I am trying to read this serial input (via UART5). However, I have some trouble parsing this data. Here is the portion of code I am using:

int b=0;
int noofreadingstoaverage5;
while (b<noofreadingstoaverage){

   //c=UARTCharGetNonBlocking(UART5_BASE);

   c=UARTCharGet(UART5_BASE);

   UARTprintf("%c",c); // echo character

   if ((c=='~')||(c==126)) {
      b++;
      UARTprintf("\n%i",b);
   }

}

   

The trouble is the input '~' is not being counted. So b remains 0. How do I fix this?

Thanks.

Mike


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>