User Tools

Site Tools




variable = BLen(channel, bufferType)

variable Variable to store results (No String or Single)
channel RS-232 channel number (1 to 3)
bufferType 0=receive buffer, 1=send buffer

BLen returns the current number of bytes in the specified RS-232 channel's buffer. If the buffer is empty, 0 will be returned. When receiving data, this function can be used to check how much data has been received before using Get or GetStr to read the data received.

If the receive buffer is full, it will not be able to receive any more data. To avoid this, use receive interrupts (see On Recv) or increase the buffer size.

Dim A As Byte
OpenCom 1,19200,0,100,50
On Recv DATARECV_RTN                   ' When data is received through
                                       ' RS232, jump to DATARECV_RTN
Loop                                   ' infinite loop
      If BLen(1,0) > 0 Then            ' If there is at least 1 byte...
            A = Get(1)                 ' Read 1 Byte
      End If
Return                                 ' End Interrupt routine

Go CUBLOC home

cubloc/blen/index.txt · Last modified: 2016/04/14 11:07 (external edit)