Programming Examples 12
Agilent InfiniiVision 5000 Series Oscilloscopes Programmer's Guide 697
End Function
Private Function DoQueryIEEEBlock_Bytes(query As String) As Long
On Error GoTo ErrorHandler
' Send query.
Call ivprintf(id, query + vbLf)
' Read definite-length block bytes.
Call ifread(id, byteArray(), ByteArraySize, vbNull, retCount)
' retCount is now actual number of bytes returned by read.
CheckForInstrumentErrors query
DoQueryIEEEBlock_Bytes = retCount
Exit Function
ErrorHandler:
MsgBox "*** Error :"+Error, vbExclamation
End
End Function
Private Sub CheckForInstrumentErrors(strCmdOrQuery As String)
On Error GoTo ErrorHandler
Dim strErrVal As String * 200
Dim strOut As String
Do
Call ivprintf(id, "SYSTem:ERRor?" + vbLf) ' Request error message.
Call ivscanf(id, "%200t", strErrVal) ' Read: Errno,"Error String".
If Val(strErrVal) <> 0 Then
strOut = strOut + "INST Error: " + RTrim(strErrVal) + vbLf
End If
Loop While Val(strErrVal) <> 0 ' End if find: 0,"No Error".
If Not strOut = "" Then
MsgBox strOut, vbExclamation, "INST Error Messages,"+_
strCmdOrQuery
Call iflush(id, I_BUF_DISCARD_READ Or I_BUF_DISCARD_WRITE)
End If
Exit Sub
ErrorHandler:
MsgBox "*** Error: " + Error, vbExclamation
End Sub