1386
Keysight InfiniiVision M9241/42/43A PXIe Oscilloscopes SCPI Programmer's Guide
40
Programming Examples
Dim strErrors As String
myScope.WriteString query
DoQueryNumbers = myScope.ReadList
CheckInstrumentErrors
Exit Function
VisaComError:
MsgBox "VISA COM Error: " + CStr(Err.Number) + ", " + _
Err. ", " + _
Err.Description, vbExclamation, "VISA COM Error"
End
End Function
Private Function DoQueryIEEEBlock_UI1(query As String) As Variant
On Error GoTo VisaComError
myScope.WriteString query
DoQueryIEEEBlock_UI1 = myScope.ReadIEEEBlock(BinaryType_UI1)
CheckInstrumentErrors
Exit Function
VisaComError:
MsgBox "VISA COM Error: " + CStr(Err.Number) + ", " + _
Err. ", " + _
Err.Description, vbExclamation, "VISA COM Error"
End
End Function
Private Sub CheckInstrumentErrors()
On Error GoTo VisaComError
Dim strErrVal As String
Dim strOut As String
myScope.WriteString ":SYSTem:ERRor?"
' Query any errors data.
strErrVal = myScope.ReadString
' Read: Errnum,"Error String".
While Val(strErrVal) <> 0
' End if find: 0,"No Error".
strOut = "INST Error: " + strErrVal
myScope.WriteString ":SYSTem:ERRor?"
' Request error message.
strErrVal = myScope.ReadString
' Read error message.
Wend
If Not strOut = "" Then
MsgBox strOut, vbExclamation, "INST Error Messages"
myScope.FlushWrite (False)
myScope.FlushRead
End If
Exit Sub