variable = Bfree(channel, bufferType
|variable||Variable to store results (No String or Single)|
|channel||RS232 Channel number (0 to 3)|
|bufferType||0=Receive Buffer, 1=Send Buffer|
This function will return the number of free bytes in a receive or send buffer. When sending data, this command can be used to avoid overflowing the buffer. When receiving data, this command can help the program wait for a specified amount of data to be received before taking action.
Dim A As Byte OpenCom 1,19200,0, 100, 50 If Bfree(1,1)>10 Then Put "TECHNOLOGY" End If
If the size of the buffer is set to 50, up to 49 bytes can be returned. When the buffer is empty, Bfree will return 1 less than the buffer size.