UART TIMEOUT


Author Message
Grogster

Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 7212
Posted: 10:20pm 24 Sep 2019      

You could also consider using the SerialRx C-function on any I/O pin, as it has a built-in timeout feature.

r = SerialRx( pin, baud-rate, string$, timeout, maxchars, termchars)

For example, r = SerialRx( 5, 9600, T$, 1000 )  will look for data for one second then return with whatever was received in T$.  You need to DIM T$ before you call this.

Here is the PDF for the Cfunction:
SerialRx.pdf

This works well, if you KNOW when to expect data, and then you go and look for it, or perhaps the data is continuously being sent with a delay between packets etc, and you just want to intercept the most current packet.
Edited 2019-09-25 08:21 by Grogster
Smoke makes things work. When the smoke gets out, it stops!