GetA channel, arrayName, byteLength
channel | RS-232 Channel (1 to 3) |
arrayName | Array to store received data (Byte type only) |
byteLength | Number of bytes to store (1 to 65535) |
The command GetA can be used to store received RS-232 data in a Byte array. Data will be stored starting from the first element of the array. Check the receive buffer with BLen before reading to avoid overflowing the buffer.
Const Device = CB280 Dim A(10) As Byte OpenCom 1,115200,3,50,10 Set Until 1,8, 10 '10 is a required dummy value, it will be ignored On Recv1 Gosub GOTDATA Do Do While In(0) = 0 Loop ' Wait until press button (Connect P0) PutStr 1,"CUBLOC",Cr Do While In(0) = 1 Loop Loop GOTDATA: GetA 1,A,8 Debug A(0),A(1),A(2),A(3),A(4),A(5),A(6),A(7) Return
In order to run the program above, please connect Rx to Tx as shown below.