This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Parsing serial input

Other Parts Discussed in Thread: MAX232

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

  • Hello Amit, I look for this ile in TivaWare and i can`t find it. Do you know where i can find it? Thanks,
    Regards,
    Diego
  • I am fairly sure it is the original poster's file. Nothing to do with TivaWare. You are attempting to compile software that is known not to work (that's why it was posted here to begin with).

    Robert
  • Hello Diego,

    That's because such a file does not exist in TivaWare. That must have been from the original poster's code and he may have not uploaded the file as it could be a link/include path.

    I may have to say that you would have to refer to one of the existing examples in TivaWare to start the development.

    Regards
    Amit
  • Markel Robregado said:
    ...it is clearly mentioned at Tiva Datasheet that you can use PIOSC as UART Baud Clock source.

    Sometimes - but not always - marketing dept's "wishes/hopes" make it into tech publications.   Even when "clearly" mentioned (and especially when clearly mentioned) such may prove untrue!   The fact that one "can use" does not suggest "guaranteed success" - and may prove unwise...

    Consider that there are two sides to any UART connection - a local & remote.   Now - it is possible that one side is communicating somewhat "above" the designated UART bit rate - and the other side is communicating somewhat "below" that designated rate.   This is "Worse Case" and must be considered along with MCU variations, aging, temperature, and errors introduced (always) by line buffers/level shifters & the commo channel.

    So any "clear" mention of "likely" success w/an uncalibrated/tested/verified PIOSC may be as much, "wishful thinking" as hard/fast reality.

    External xtals - properly installed & mated to proper caps - prove the "Gold Standard" in securing reliable UART communication.   (and such holds true even if (and especially if) never "clearly mentioned" w/in MCU manual...)