Agilent Technologies E1442-90003 Switch User Manual


 
E1442A Application Examples 47Chapter 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 switch module. The program monitors the switch’s Standard
Event Status Register for an error condition.
If no errors occur, the switch module functions as programmed. If errors do
occur, the switch module interrupts the computer, and the error codes and
messages are read from the error queue. This BASIC programming
example has a single switch module at address 70915.
10
20
30
40 ON INTR 7 CALL Errmsg
&DOOto print out error message
50 ENABLE INTR7:2
60
70
80
90
100 OUTPUT 70915;"*SRE 32"
!Enables the standard event summary bit SRE
110 OUTPUT 70915;"*ESE 60"
!Enables all parser generated errors
!See STATus command figure
120
130
140
.
.
190 END
200 !
210
220
230
240
250 SUB Errmsg
! Define interrupt service routine
260 DIM A$[256]
! Declare response string
270 CLEAR 70915
! Clear the switch module
280 B = SPOLL(70915)
! Fetch status byte
290 REPEAT
! Repeat
300 OUTPUT 70915;"SYST:ERR?"
! Query for error
310 ENTER 70915;Code,A$
! Read response
320 PRINT Code,A$
! Print error
330 UNTIL Code=0
! Keep querying for an error until error code = 0
340 OUTPUT 70915;"*CLS"
! Clear status registers/error queue
350 STOP
360 SUBEND