133
Programming Examples
Example 2 - Status Registers and Queues
340 PRINT TABXY(4,10);"^^^^^^^^"
350 PRINT TABXY(4,11);" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
360 PRINT TABXY(4,12);" :::::::::"
370 PRINT TABXY(4,13);" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"
380 PRINT TABXY(4,14);" PON URQ CME EXE DDE QYE RQC OPC"
390 PRINT TABXY(40,12);"Standard Event Status Register"
400 PRINT TABXY(4,16);"Last Command :"
410 PRINT TABXY(4,17);"Last Error :"
420 PRINT TABXY(4,18);"Output Queue :"
430 !
440 ! Start the program loop and enable the interrupt for the
errors
450 !
460 Ende=0
470 GOSUB Pmm_srq
480 ENABLE INTR 7;2
490 !
500 ! The Central Loop
510 !
520 REPEAT
530 INPUT "Command ? ",Inp$
540 GOSUB Pmm_srq
550 OUTPUT Att;Inp$
560 PRINT TABXY(21,16);"
"
570 PRINT TABXY(21,16);Inp$
580 WAIT 1.0
590 UNTIL Ende=1
600 GOTO 1380
610 !
620 !----------------------------------------------------
630 Pmm_srq: ! Interrupt Handling Subroutine to display the
640 ! status and the error and output queues
650 !----------------------------------------------------
660 !
670 ! Get the value for the Status Byte
680 !
690 Value=SPOLL(Att)
700 !
710 ! Initialize and start the display of the registers
720 !
730 PRINT TABXY(21,17);"
"
740 PRINT TABXY(21,18);"
"
750 Ypos=3
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"