
2-12
IM AQ6370C-17EN
'==================================================
' Sub routine
' Send Remote Command
'==================================================
Sub SendGPIB(intAddr As Integer, strData As String)
Call Send(BOARD_ID, intAddr, strData, NLend)
If (ibsta And EERR) Then
MsgBox " GP-IB device can't write"
End If
End Sub
'==================================================
' Sub routine
' Recieve Binary query data
'==================================================
Function RecieveBinaryGPIB(intAdr As Integer, byteArray() As Byte) As
Long
Const READSIZE = 1200000
' MAX 1.2MB
Dim lngSize As Long
Dim lngL As Long
Dim lngPos As Long
Dim ud As Integer
Dim byteLow As Byte
Dim byteHigh As Byte
Dim strA As String
Dim intDummy(READSIZE) As Integer
lngSize = 0
'----- open device
ud = ildev(0, intAdr, 0, T30s, 1, 0)
lngPos = 0
'----- read data
Do
DoEvents
Call ibrdi(ud, intDummy, READSIZE)
If (ibsta And EERR) Then
MsgBox "GP-IB device can't Read(GPIB:" & intAdr & ")"
RecieveBinaryGPIB = 0
Exit
Function
Else
ReDim Preserve byteArray( 2)
For lngL = 0 To ibcntl / 2 - 1
strA = Right("0000" & Hex(intDummy(lngL)), 4)
byteHigh = Val("&H" + Left(strA, 2))
byteLow = Val("&H" + Right(strA, 2))
byteArray(lngPos)
=
byteLow
byteArray( 1) = byteHigh
lngPos = 2
Next
lngL
End If
Loop While (ibcntl = READSIZE)
RecieveBinaryGPIB = lngPos
End Function
2.6 Sample Program