6
Example 2 - Status Registers and Queues
760 FOR Z=0 TO 1
770 Bit=128
780 Xpos=7
790 !
800 ! Do it for each bit
810 !
820 REPEAT
830 Quot=Value DIV Bit
840 !
850 ! If the bit is set then display 1
860 !
870 IF Quot>0 THEN
880 PRINT TABXY(Xpos,Ypos);"1"
890 Value=Value-Bit
900 !
910 ! If MAV is set, then get and display the output queue contents
920 !
930 IF Z=0 THEN
940 IF Bit=16 THEN
950 ENTER Tls;A$
960 PRINT TABXY(21,18);A$
970 END IF
980 END IF
990 !
1000 ! If the bit is not set, then display 0
1010 !
1020 ELSE
1030 PRINT TABXY(Xpos,Ypos);"0"
1040 END IF
1050 !
1060 ! Set up for the next iteration
1070 !
1080 Bit=Bit DIV 2
1090 Xpos=Xpos+4
1100 UNTIL Bit=0
1110 !
1120 ! Now that the status byte is displayed, get the Standard Events
1130 ! Status Register
1140 !
1150 OUTPUT Tls;"*ESR?"
1160 ENTER Tls;Value
1170 !
1180 ! Set up to display the ESR
1190 !
1200 Ypos=12
1210 NEXT Z
Programming Examples 6-5