... continued
The following subroutine may be included in the GLOBAL.BAS file.
’ HPIB.DLL Access
’ Put into your GLOBAL.BAS file
•
•
•
Global isc As Long
Global device As Long
Global hHpib As Integer
Global errnum As Integer
Sub check_srq ()
condition = 1
’ Display any errors caused by the return of an HPIB command.
If errnum% <> NOERROR Then
MsgBox ("Error = " + HpibErrStr$(errnum%))
End If
’ Wait for the completion of the current command.
errnum% = HpibOutPutS(hHpib%, device&, "*OPC?", 5)
errnum% = HpibEnter(hHpib%, device&, done!)
’ If there is an error bit set, obtain the error.
errnum% = HpibSpoll(hHpib%, device&, response%)
If response% And 32 Then
syst_err$ = "SYST:ERR?"
errnum% = HpibOutPutS(hHpib%, device&, syst_err$, Len(syst_err$))
errnum% = HpibEnter(hHpib%, device&, errx!)
actual% = 80
MsgBox ("Error=" + Str$(errx!))
errnum% = HpibOutPutS(hHpib%, device&, "*CLS", 4)
End If
’ Obtain other HPIB errors.
errnum% = HpibStatus(hHpib%, isc&, condition, Status%)
If errnum% <> NOERROR Then
MsgBox ("Error = " + HpibErrStr$(errnum%))
End If
If Status% = 1 Then
errnum% = HpibSpoll(hHpib%, device&, Status%)
If errnum% <> NOERROR Then
MsgBox ("Error = " + HpibErrStr$(errnum%))
End If
End If
End Sub
6
Chapter 6 Application Programs
Microsoft Visual Basic Language Program
229