Program Example
The following program example sends a SCPI command and returns the data into a string variable.
Sub Main ()
Dim Addr As Integer
Dim Cmd As String
Dim RdMsg As String * 256
Dim Length As Integer
Dim Actual As Long
’ SCPI command
Cmd = “SYSTem:ERRor?” + Chr$(10)
’ Open communication path using GPIB address
Addr = iopen("hpib7,9,0")
’ Send SCPI command
Call iwrite(Addr, ByVal Cmd, Len(Cmd), 1, Actual)
’ Set space for returned data
Length = 256
’ Get readings
Call iread(Addr, ByVal RdMsg, Length, 0, Actual)
’ Show readings
MsgBox RdMsg, 0
’ Close communication with instrument
Call iclose(Addr)
’ Clean up sicl (for Windows only)
Call siclcleanup
End
End Sub
2-4 Sending SCPI Commands