INPUTBIN

INPUTBIN

Top  Previous  Next

Action

Read binary data from the serial port.

 

 

Syntax

INPUTBIN var1 [,var2]

INPUTBIN #channel , var1 [,var2]

 

 

Remarks

var1

The variable that is assigned with the characters from the serial port.

 

var2

An optional second (or more) variable that is assigned with the data from the serial input stream.

 

The channel is for use with the software UART routine and must be used with OPEN and CLOSE.

 

The number of bytes to read depends on the variable you use.

When you use a byte variable, 1 character is read from the serial port.

An integer will wait for 2 characters and an array will wait until the whole array is filled.

 

Note that the INPUTBIN statement doesn't wait for a CRLF but just for the number of bytes.

 

You may also specify an additional numeric parameter that specifies how many bytes will be read. This is convenient when you are filling an array.

 

Inputbin ar(1) , 4 ' will fill 4 bytes starting at index 1.

 

 

See also

PRINTBIN

 

 

Example

Dim A As Byte , C As Integer

Inputbin A , C 'wait for 3 characters

End