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.

The Number symbol (#) prefix is optional, but recommended for the purposes of clarity.

Restrictions

Avoid using ASCIIZ string to hold binary data, as any embedded CHR$(0) or $NUL characters will be misunderstood as indicating the end of the string.

See also

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

Example

Qty& = COMM(#hComm, RXQUE)

COMM RECV #hComm, Qty&, a$