COMM RECV statement  

Purpose

Receive binary data from a serial port.

Syntax

COMM RECV [#] hComm, count&, string_var

Remarks

Retrieve the count& number of bytes from the receive buffer, placing the results in string_var.  Program execution will halt until count& bytes are available, so it is wise to check how many bytes are available before making a COMM RECV request.  You can do this by checking the RXQUE value with the COMM function, as shown in the example below.

hComm is the file number you used with COMM OPEN, an integer in the range of 1 to 32767.  The Number symbol (#) prefix is optional, but recommended for clarity.

The data received is assigned to the string_var.  The character mode of the string_var must match the CHR option in COMM OPEN (ANSI/WIDE). If not, an error 5 (Illegal function call) will be generated, and no data will be received.

See also

Serial CommunicationsCOMM CLOSE, COMM functionCOMM LINE, COMM OPEN, COMM PRINT, COMM RESET, COMM SEND, COMM SET, COMM TIMEOUT

Example

Qty& = COMM(#hComm, RXQUE)

COMM RECV #hComm, Qty&, a$