<< Prev        Next >>

ID : 609

Data Communication in Binary Mode

Data communication in binary mode is performed as follows.

For transmission

Sub SampleBinaryOutPut
Dim var As Variant
Dim n As Integer
var = CreateArray( 10 )  'One-dimensional array with 10 bytes is created.

var(0) = &ha2
var(1) = &hFF
var(2) = &h35
var(3) = &h3c
var(4) = &h7b
var(5) = &hFF
var(6) = &hFF
var(7) = &h45
var(8) = &h87
var(9) = &h99
Comm.Open 2
Comm.Output 2,var
Comm.Close 2
End Sub
For reception

Sub SampleBinaryInput
Dim var As Variant
Dim nmax As Integer
Dim n As Integer

var = Comm.Input(2) 
nmax = Ubound(var)

For n = 0 To nmax
   I[n] = var(n)
Next
End Sub

Related Terms

CreateArray, UBound

ID : 609

<< Prev        Next >>