User manual
Using the Relay Multiplexer 57Chapter 2
Example: Error Checking
Using Interrupts
The second approach to error checking involves the use of interrupts. The
following program is a method of checking for errors using interrupts as you
program the multiplexer. The program monitors the multiplexer’s Standard
Event Status Register for an error condition. See the E1406A Command
Module User’s Manual for detailed information on the Standard Event Status
Registers.
If no errors occur, the multiplexer functions as programmed. If errors do
occur, the multiplexer interrupts the computer and the error codes and
messages are read from the error queue. This example uses GPIB select
code 7, primary address 09, and secondary address 14 for the multiplexer.
10 ON INTR 7 CALL Errmsg
!Call computer subprogram "Errmsg" if a
multiplexer programming error occurs
20 ENABLE INTR 7:2
!Enable the computer to respond to an
interrupt from the multiplexer
30 OUTPUT 70914;"*SRE 32"
!Unmask the event status bit in the
multiplexer’s Status Register
40 OUTPUT 70914;"*ESE 64"
!Unmask the error conditions in multiplexer
Standard Event Status Register
50 .
!Program multiplexer for desired application
60 .
70 .
80 END
90 SUB Errmsg
!Error Message subprogram
100 DIM Message$[256]
120 CLEAR 70914
!When an error occurs, clear the multiplexer
to regain control
130 B = SPOLL (70914)
!Execute a serial poll to clear the service
request bit in the Status Register
140 REPEAT
150 OUTPUT 70914;"SYST:ERR?"
!Read all error messages in the multiplexer
error queue
160 ENTER 70914:Code,Message$
170 PRINT Code,Message$
180 UNTIL Code = 0
190 OUTPUT 70914;"*CLS"
!Clear all bits in the multiplexer’s Standard
Event Status Register
200 STOP
210 SUBEND