Serial read - String data delay
When using the Serial read block, general data types can be received in real-time, but strings may experience delays, causing the received string to be from the previous data. I conducted a simple test and found that when receiving string data, the first trigger is ignored, leading to subsequent data being the same as the previous one. How can I resolve this issue?
Answers
-
Hi Robert Lee,
Sorry for replying this late. This seems to be expected behavior as processing char data type is instantaneous while it would require sometime to process strings and correctly display.
When sending or receiving string data, at backend, we process the data stream to formulate the string while checking for start string, end string parameters, converting numeral data to string (as in your case). This requires some kind of post processing and thus consume some time. But for character data, we just populate the display as and when the character data is sent or received. This is why no delay is observed for character data.
A 10 char string may take 10x longer than single char. At 9600 baud, if a char takes ~1ms, a string would take 10ms.
0