Specifications
136 Chapter 10
Error Handling
Sample Program
Sample Program
Example 10-1 is a sample program for detecting an error via an SRQ. This program is
given the file name srq_err.bas and is stored on the sample program disk.
This program performs the necessary SRQ settings, intentionally sends a command that is
not supported by the 4287A to cause an error, and then handles the error after it occurs. In
the error handling, the error is identified and its error number and message are displayed
followed by a message showing that the program is aborted.
Lines 40 to 50 Sets the GPIB address and select code.
Lines 70 to 80 Sets bits 2, 3, 4 and 5 of the standard event status register to be enabled
and sets bit 5 of the service request enable register to 1.
Lines 90 to 110 Clears the status byte register, standard event status register, and error
queue.
Lines 130 to 140 Sets the branch target for an SRQ interrupt to enable SRQ interrupts.
Lines 150 to 240 Sets measurement parameters 1 through 4, intentionally specifying an
incorrect command for parameter 4 to cause an error.
Lines 270 to 280 Performs error handling. The number and message of the error are
read out.
Lines 290 to 310 Displays a message showing that an error has occurred, the error
number, error message, and another message indicating that the
program is aborted.
Line 330 Displays a message for normal termination of the program. Note that
this will not be displayed unless the program is modified to employ the
appropriate command for measurement parameter 4.