152 Keysight E4981A 120 Hz/1 kHz/1 MHz Capacitance Meter
Measurement Applications (Sample Programs)
Detecting Error Occurrence using SRQ (HT Basic)
9-
Detecting Error Occurrence using SRQ (HT Basic)
Example 9-17 shows a sample program to detect the occurrence of an error
using SRQ. This program is stored on the sample program disk under the
filename “srq_err.bas”.
This program sets up SRQ, intentionally sends a nonexistent command for the
E4981A to generate an error, and performs error handling. In the error
handling, the program checks which error has occurred, displays the error
number and error message, and displays the “PROGRAM INTERRUPT”
message.
Line 40 Sets the GPIB address.
Lines 60 to 70 Enables bit 2, bit 3, bit 4, and bit 5 of the standard event
status register and sets bit 5 of the service request enable
register to 1.
Lines 80 to 100 Clears the status byte register, standard event status
register, and error queue.
Lines 120 to 130 Sets the branch destination of the SRQ interrupt and
enables SRQ interrupt.
Lines 140 to 190 Selects the primary parameter and secondary parameter.
However, because the command for the secondary
parameter is wrong, an error occurs.
Lines 220 to 230 Processing when an error occurs. Reads out the error
number and error message of the error that has occurred.
Lines 240 to 260 Displays the “Error occurred!!” message, error number,
error message, and “PROGRAM INTERRUPT!!” message.
Line 280 Displays the “PROGRAM DONE” Message. Notice that this
message is not displayed unless you correct and execute
the secondary parameter selection command.