SerRcv

(Engine-Level Function)

Description: Serial Port Receive. This function returns a buffer containing a string read from the receive buffer.
Returns: Buffer
Usage: Script Only.
Function Groups: Serial Port
Related to: COMPort | SerCheck | SerIn | StrLen | SerOut | SerRTS | SerSend | SerStrEsc | SerString | SerWait
Format: SerRcv(Port, Count)
Parameters:  
Port
Required. Any numeric expression for the serial port number (opened with a ComPort function) or any stream value.
Count
Required. Any numeric expression, which gives the number of bytes to read. Value must be in the range 0 to 65500.
Comments: The return value is a buffer containing Count bytes, unless fewer bytes were available in the receive buffer. This function may be used to flush the serial port receive buffer.

Example:

If SerWait(2, 12) { Wait for 12 bytes buffered for port 2};
[
  data = SerRcv(2, 12);
]

This waits until 12 bytes are in the receive buffer for serial port 2, and then reads them into the variable data. Byte 0 of data will be the oldest byte in the receive buffer (received first by VTS).