serialControlString timeout to=on off on all platforms
Posted: Tue Dec 16, 2008 10:19 am
Could anyone explain how I can get a timeout to work when reading the serial port?
I have tried setting the serialcontrolstring to "to=on" or "to=off"
along with the command
read from [file or driver] ["COM1:" or "/dev/ttyUSB0"] until empty [in 5 seconds]
hoping it would timeout after 5 seconds of no data.
But I can never seem to get it to timeout. If there is no data, the program just waits for an input. I need my app to terminate if there is no input on the com port.
I can get something to work using:
read from file "COM1:" until lf
but this only reads one line, and only works if there's data present. There can be bursts of data from 0 up to 10 lines at a time. ending in crlf.
Also once I have set the serialControlString with all parameters then change 1 parameter such as "BAUD=19200" does this affect the rest of the parameters?
I have tried setting the serialcontrolstring to "to=on" or "to=off"
along with the command
read from [file or driver] ["COM1:" or "/dev/ttyUSB0"] until empty [in 5 seconds]
hoping it would timeout after 5 seconds of no data.
But I can never seem to get it to timeout. If there is no data, the program just waits for an input. I need my app to terminate if there is no input on the com port.
I can get something to work using:
read from file "COM1:" until lf
but this only reads one line, and only works if there's data present. There can be bursts of data from 0 up to 10 lines at a time. ending in crlf.
Also once I have set the serialControlString with all parameters then change 1 parameter such as "BAUD=19200" does this affect the rest of the parameters?