12-04-2013 06:51 AM
Hi,
I need an UART read function that should read the stream and return when at least two specific characters are received. ComRdTerm has only one termination character. Is there maybe a workaround or method that will get it right?
Example:
TermChar: 0x0C 0x0A (in the same order) Stream: 0x01 0x02 0x0A 0x0B 0x0C 0x0D 0x0F 0x0C 0x0A -no- -no- -end-
Solved! Go to Solution.
12-04-2013 07:02 AM
As you can read in the help for the command:
If the termination character is a carriage return (CR or decimal 13) or a linefeed (LF or decimal 10), the function handles it as follows:
Does it satisfy your needs?
12-04-2013 07:50 AM
The stream I receive is not ready when "CR" or "LF" character are received, only "CR + LF".
Example:
0x01 0x00 0x00 0x00 0x0C <- dont stop here 0x00 0x00 0x0A <- dont stop here also 0x00 0x00 0x0C 0x0A <-stop here
ComRdTerm will stop at 0x0C. But its not what I need.
12-04-2013 10:00 AM
In this case ComRdTerm is not your solution: you must read periodically, accumulate in a buffer and handle the buffer. You can read wither with a Com callback triggered for any byte received or with a periodic task such a timer or so.