Serial port handling


Well-Known Member
Licensed User
I have been using the serial library with some partial success, and am looking how I may avoid data loss. This is with no lower-level handshaking, just a package protocol (actually from Garmin for their GPS).

The Help for the serial keywords doesn't say much about how they interact. For instance I assume that doing InputArray() empties the input buffer so that the same data cannot be read again.

But what is the effect of the Timeout? What actions does it influence, and how to tell if there has been a timeout event?

Regards, Mike.


Staff member
Licensed User
InputArray reads (and empties) all the data that is waiting in the input buffer.
It is however possible that while you read the data, new data arrives.

Timeout affects the time to wait before the program raises a timeout error when you read or write data to the serial port.
The default is Infinite.
If a timeout occurs an error will be raised.


Well-Known Member
Licensed User
Ah, thanks for correcting the "infinite" timeout; I had already tried displaying the default value and infinity might have overloaded the message box somewhat! :signOops:

100mS isn't very long, so now I wonder why I haven't triggered this timeout already.

I have now started looking at ErrorLabel and exception handling...

Regards, Mike