Programming Examples
12
Agilent InfiniiVision 7000A Series Oscilloscopes Programmer's Guide
863
Private Sub CheckInstrumentErrors()
On Error GoTo ErrorHandler
Dim strErrVal As String * 200
Dim strOut As String
err = viVPrintf(vi, ":SYSTem:ERRor?" + vbLf, 0)
' Query any errors.
If (err <> VI_SUCCESS) Then HandleVISAError vi
err = viVScanf(vi, "%t", strErrVal)
' Read: Errnum,"Error String".
If (err <> VI_SUCCESS) Then HandleVISAError vi
While Val(strErrVal) <> 0
' End if find: 0,"No Error".
strOut = "INST Error: " + strErrVal
err = viVPrintf(vi, ":SYSTem:ERRor?" + vbLf, 0)
' Request error.
If (err <> VI_SUCCESS) Then HandleVISAError vi
err = viVScanf(vi, "%t", strErrVal)
' Read error message.
If (err <> VI_SUCCESS) Then HandleVISAError vi
Wend
If Not strOut = "" Then
MsgBox strOut, vbExclamation, "INST Error Messages"
err = viFlush(vi, VI_READ_BUF)
If (err <> VI_SUCCESS) Then HandleVISAError vi
err = viFlush(vi, VI_WRITE_BUF)
If (err <> VI_SUCCESS) Then HandleVISAError vi
End If
Exit Sub
ErrorHandler:
MsgBox "*** Error : " + Error, vbExclamation
End
End Sub
Private Sub HandleVISAError(session As Long)
Dim strVisaErr As String * 200
Call viStatusDesc(session, err, strVisaErr)
MsgBox "*** VISA Error : " + strVisaErr, vbExclamation
' If the error is not a warning, close the session.
If err < VI_SUCCESS Then
If session <> 0 Then Call viClose(session)
End
End If
Summary of Contents for InfiniiVision 7000A Series
Page 1: ...Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide...
Page 34: ...34 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 1 What s New...
Page 44: ...44 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 2 Setting Up...
Page 58: ...58 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 3 Getting Started...
Page 750: ...750 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide 8 Error Messages...
Page 922: ...922 Agilent InfiniiVision 7000A Series Oscilloscopes Programmer s Guide Index...