serialWait
|
· | the number of characters in the receive buffer becomes greater or equal to the input threshold specified in serialOpent.
|
· | the number of characters in the transmit buffer becomes less than the output threshold specified in serialOpen.
|
|
|
Timeout
|
|
Integer specifying the maximum time to wait in milliseconds. If this parameter is omitted, the timeout will never occur.
|
|
ERR_OK
|
|
The flag set if successful.
|
|
ERR_TIMEOUT
|
|
The timeout occurred.
|
|
ERR_FAILED
|
|
The flag set if failed.
|
|
ERR_NOTFOUND
|
|
No open port found
|
|
|
To open and configure a serial port, use serialOpen.
|
|
|
This set of statements demonstrates a cycle of serial communication waiting for a triad of characters to come to a serial port and printing them in the terminal window. A triad of "0" is used to exit the cycle.
|
|
serialOpen(1,"19200,N,8,1",3)
|
Do
|
serialWait(10000)
|
if(getError()=ERR_TIMEOUT) Then
|
MsgBox ("No data in the serial port")
|
goto M1
|
End If
|
str=serialRead()
|
Print str
|
M1: Loop While str <> "000"
|
serialClose()
|
|