Section 10 Program Examples
10-8
(5) Examining details on errors
When there is information (error occurrence, processing end, etc.) that a device (MS9710C) wants to report to
a controller (personal computer) to perform GPIB control, the device reports it to the controller using a status
byte. There are two methods to check the status byte: a method by which an SRQ interrupt is issued to the
controller to force the controller to check the status byte and a method by which the controller is expected to
check the status byte voluntarily.
Let’s take a look at the former method.
Shown below is an example of a program that consists of a main processing block (lines 70 to 450) and an
interrupt block (lines 500 to 820). Assume that the interrupt processing block is a task that is activated when
an SRQ interrupt event occurs.
70 PROCESS EVENT SRQ“@01, 02”
80 START GPIB
90 CONNECT EVENT SRQ
100 ENABLE HANDLER READERR
110 !
120 WRITE @108 : “∗CLS”
130 WRITE @108 : “∗SRE 40” ! Set ESB, ERROR bit to STB
140 WRITE @108 : “∗ESE 60” ! Set QERR, DDE, EXE, CERR bit to SESER
150 WRITE @108 : “ESE3 1”
160 !
170 ENABLE TIMEOUT 3
180 !
190 !
200 !
400 HANDLER READERR
410 PRINT “∗∗∗ Query read error ∗∗∗”
420 CONTINUE
430 END HANDLER
440 !
450 END
500 ! ========================================
510 PARACT GPIB URGENCY 80
520 GPINT : WAIT EVENT SRQ
530 WRITE @108 : “∗STB?”
540 READ @108 : STB
550 IF BIT (3, STB) = 1 THEN
560 PRINT “∗∗∗ RES Uncal ∗∗∗”
570 END IF
580 IF BIT (5, STB) = 1 THEN
590 WRITE @108 : “∗ESR?” !
600 READ @108 : ESR
610 IF BIT (2, ESR) = 1 THEN
620 PRINT “∗∗∗ Query error ∗∗∗”