7-20 Chapter7
Programming Examples
Measurement Setup Examples
If (vi <> VI_NULL) Then
err_status = hp875x_error_message(vi, err_status, err_msg)
msg = msg & “, Error Status: “ & err_status
msg = msg & “, Error Message: “ & err_msg
End If
MsgBox msg, vbInformation, frmExample1a.Caption
End
End If
End Sub
Sub checkErr(ByVal vi As Long, ByVal err_status As Long)
Dim inst_err As Long
Dim err_message As String * 250
Dim retStatus As Long
Dim nl
nl = Chr(10)
If VI_SUCCESS > err_status Then
‘Send a device clear to ensure communication with ‘the instrument.
retStatus = hp875x_dcl(vi)
If (hp875x_INSTR_ERROR_DETECTED = err_status) Then
‘query the instrument for the error
retStatus = hp875x_error_query(vi, inst_err, err_message)
msg = “CHECK :Instrument Error :” & inst_err & nl & “Error Message = “ &
err_message
MsgBox msg, vbOKOnly, frmExample1a.Caption
Else
‘get the driver error message
retStatus = hp875x_error_message(vi, err_status, err_message)
msg = “CHECK :Driver Error :” & errStatus & nl & “Error Message = “ &
err_message
MsgBox msg, vbInformation, frmExample1a.Caption
End If
End If
‘ optionally reset the instrument, close the instrument handle
‘retStatus=hp875x_reset(vi)
‘retStatus=hp875x_close(vi)
End Sub