Description: Get Serial Port Byte. This function returns the next byte in the receive buffer.
Returns: Byte
Usage: Script
Format: SerIn(Port, Peek)
Parameters: Port { numeric } { required } { no default: }
Any numeric expression for the serial port number (opened with a ComPort function) or any stream value.
Peek { Boolean } { required } { no default: }
Any status expression. If Peek is true, the byte is not removed from the receive buffer. If Peek is false, the byte is removed from the receive buffer.
Comments: If no byte is available, the return value is invalid.
Example:
If 1 Continue;
[
chkSum = SerIn(2, 0);
IfThen(! Valid(chkSum), ForceState("Wait"));
]
This reads one byte from the receive buffer for serial port 2; if none is available, chkSum will be invalid. Notice that the next state to become active is dependent on whether or not a byte has been successfully read.
See Also:
ComPort | SerCheck | SerLen | SerOut | SerRcv | SerRTS | SerSend | SerStrEsc | SerString | SerWait