Sample program – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 86

II. SOFTWARE GUIDES - 8. Driver488/DRV
8G. QuickBASIC
Personal488 User’s Manual, Rev. 3.0
II-71
Bit
DIO7
, with a value of
64
, is returned as true (
1
) in the Serial Poll response of those devices
requesting service. In our simple example, we expect that the 195 is the only possible cause of an
SRQ
,
and if not, there must be some error.
Now that we have identified the device that is requesting service, we can further examine the Serial
Poll status to classify the request. If DIO6 is set, then the 195 is signaling an error condition. If that bit
is clear, some non-error condition caused the
SRQ
:
2160 IF (ST195 AND 32)=0 THEN ‘Test ERROR Status Bit
‘Interpret no-error status
2210 IF ST195 AND 1 THEN PRINT “Overflow”
2220 IF ST195 AND 2 THEN PRINT “Buffer Full”
2230 IF ST195 AND 4 THEN PRINT “Buffer 1/2 Full”
2240 IF ST195 AND 8 THEN PRINT “Reading Done”
2250 IF ST195 AND 16 THEN PRINT “Busy”
2260 ELSE
‘Interpret error status
2310 IF ST195 AND 1 THEN PRINT “Illegal Command Option”
2320 IF ST195 AND 2 THEN PRINT “Illegal Command”
2330 IF ST195 AND 4 THEN PRINT “No Remote”
2340 IF ST195 AND 8 THEN PRINT “Trigger Overrun”
2350 IF ST195 AND 16 THEN PRINT “Failed Selftest”
2360 END IF
Finally, once we have diagnosed the error, we are ready to return to the main program:
2400 RETURN
Sample Program
100 ‘Establish communications with Driver488/DRV
110 OPEN “\DEV\IEEEOUT” FOR OUTPUT AS #1
120 ‘
150 ‘Reset Driver488/DRV
160 IOCTL#1,"BREAK"
170 PRINT#1,"RESET"
180 ‘
190 ‘Open file to read responses from Driver488/DRV
200 OPEN “\DEV\IEEEIN” FOR INPUT AS #2
225 PRINT#1,"FILL ERROR"
250 ON PEN GOSUB ISR
260 PEN ON
270 PRINT#1,"ARM SRQ"
310 PRINT#1,"HELLO"
320 INPUT#2,A$
330 PRINT A$
410 PRINT#1,"STATUS"
420 INPUT#2,ST$
430 PRINT ST$
550 PRINT#1,"OUTPUT 16;M2X"
610 PRINT#1,"OUTPUT 16;F0R0X"
710 PRINT#1,"ENTER 16"
720 INPUT#2,R$
730 PRINT R$
740 N$=MID$(R$,5)
741 N=VAL(N$)
742 PRINT “The read value is”;N
740 PRINT “The read value is”;VAL(MID$(R$,5))
810 SUM=0
820 FOR I=1 TO 10
830 PRINT#1,"ENTER 16"
840 INPUT#2,R$
850 SUM=SUM+VAL(MID$(R$,5))
860 NEXT I
870 PRINT “The average of ten readings is”;SUM/10
910 R$=SPACE$(1700)
980 PRINT#1,"STATUS"