301
Chapter 5, Advanced Operations
GPIB Service Requests
900 ! decimal value = 2^5 = 32
910 ! Bit 3 = Questionable Data/Signal Register Group Summary Message
920 ! decimal value = 2^3 = 8
930 ! Bit 0 = Hardware Status Register #1 Group Summary Message
940 ! decimal value = 2^0 = 1
950 !
960 Srq_enab_reg=32+8+1
970 OUTPUT Inst_address;"*SRE";Srq_enab_reg
980 !
990 ! 5) Set up the Active Controller to respond to an SRQ interrupt:
1000 ! Call subprogram Check_interrupt if an SRQ condition exists on select
1010 ! code 7. The interrupt priority level is set to 15 (highest level).
1020 !
1030 ON INTR 7,15 CALL Srvice_interupt
1040 !
1050 ! 6) Enable interrupts on select code 7:
1060 ! The interface mask is set to a value of 2 which enables interrupts on
1070 ! the GPIB bus when the SRQ line is asserted.
1080 !
1090 ENABLE INTR 7;2
1100 !
1110 ! Start of the dummy loop:
1120 !
1130 LOOP
1140 DISP "I am sitting in a dummy loop."
1150 END LOOP
1160 !
1170 END
1180 !
1190 Srvice_interupt:SUB Srvice_interupt
1200 !
1210 OPTION BASE 1
1220 COM /Io_names/ INTEGER Inst_address,Std_event_reg,Calibration_reg
1230 COM / Io_names/ INTEGER Hardware1_reg,Srq_enab_reg,Status_byte,Event_reg
1240 !
1250 !Turn off interrupts while processing the current interrupt.
1260 OFF INTR 7
1270 !
1280 !Conduct a SERIAL POLL to read the Status Byte and clear the SRQ:
1290 !
1300 Status_byte=SPOLL(Inst_address)
1310 !
1320 ! Determine which Register Group(s) caused the interrupt. Since three
1330 ! were enabled, all three must be checked:
1340 !
1350 IF BIT(Status_byte,5) THEN GOSUB Srvice_std_evnt
1360 IF BIT(Status_byte,3) THEN GOSUB Srvice_calib
1370 IF BIT(Status_byte,0) THEN GOSUB Srvice_hard1
1380 !
1390 ! Re-enable the interrupt before leaving the service routine