16-51
IM 765501-01E
Communication
Commands
3
2
1
6
5
4
9
8
7
12
11
10
15
14
13
18
17
16
16
Index
App
‘ Query function
Function CommQuery(dev As Integer, snd_msg As String) As String
Dim rcv_msg As String * 64
Dim ret As Integer
ret = CommSend(dev, snd_msg)
If (ret < 0) Then
CommQuery = “ERROR”
Else
ret = CommRecv(dev, rcv_msg)
If (ret <= 0) Then
CommQuery = “ERROR”
Else
CommQuery = Left$(rcv_msg, ret - 1)
End If
End If
End Function
‘ Device clear
Sub CommClear(dev As Integer)
ilclr dev
End Sub
‘ Serial polling
Function CommPoll(dev As Integer) As Integer
Dim ret As Integer
If (ilrsp(dev, ret) And EERR) Then
CommPoll = -1
Else
CommPoll = ret
End If
End Function
‘ Read the source status
Function CommSourceStatus(dev As Integer) As Integer
Dim msg As String * 64
msg = CommQuery(dev, “:STAT:SOUR:COND?”)
If (msg = “ERROR”) Then
CommSourceStatus = -1
Else
CommSourceStatus = Val(msg)
End If
End Function
‘ Read the source event
Function CommSourceEvent(dev As Integer) As Integer
Dim msg As String * 64
msg = CommQuery(dev, “:STAT:SOUR:EVEN?”)
If (msg = “ERROR”) Then
CommSourceEvent = -1
Else
CommSourceEvent = Val(msg)
End If
End Function
‘ Read the measure status
Function CommMeasureStatus(dev As Integer) As Integer
Dim msg As String * 64
msg = CommQuery(dev, “:STAT:SENS:COND?”)
If (msg = “ERROR”) Then
CommMeasureStatus = -1
Else
CommMeasureStatus = Val(msg)
End If
End Function
16.4 Sample Programs