Specifications

Chapter 5 71
Starting Measurement Cycle (Triggering) and Detecting End of Measurement
Waiting for (Detecting) End of Measurement
5. Starting Measurement
Cycle (Triggering) and Detecting
End of Measurement
Sample program
Example 5-1 is a sample program using an SRQ to detect the end of measurement. This
program is given the file name srq_meas.bas and stored on the sample program disk.
This program aborts the trigger system, makes the SRQ setting, and then initiates the
trigger system one time. When an SRQ is generated at the end of measurement, the
program displays the end message and then finishes.
Details of the program are as follows.
Lines 30 to 40 Sets the GPIB address and the select code.
Lines 60 to 70 Aborts the trigger system and sets the trigger source to the internal
trigger.
Lines 90 to 100 Sets the positive transition filter to 0 and the negative transition filter
to 1 so that the operation status event register at bit 4 is set to 1 only
when the operation status condition register at bit 4 is changed from 1
to 0.
Lines 110 to 120 Enables bit 4 in the operation status event register and bit 8 in the
status byte register.
Lines 130 to 150 Clears the operation status event register and the status byte register.
Lines 170 to 180 Sets the branch destination for the SRQ interrupt and enables the SRQ
interrupt.
Lines 190 to 210 Initiates the trigger system one time and then waits for the end of
measurement.
Example 5-1 Detecting the end of measurement using an SRQ (srq_meas.bas)
10 DIM Buff$[9]
20 INTEGER Scode
30 ASSIGN @Agt4287a TO 717
40 Scode=7
50 !
60 OUTPUT @Agt4287a;":ABOR"
70 OUTPUT @Agt4287a;":TRIG:SOUR INT"
80 !
90 OUTPUT @Agt4287a;":STAT:OPER:PTR 0"
100 OUTPUT @Agt4287a;":STAT:OPER:NTR 16"
110 OUTPUT @Agt4287a;":STAT:OPER:ENAB 16"
120 OUTPUT @Agt4287a;"*SRE 128"
130 OUTPUT @Agt4287a;"*CLS"
140 OUTPUT @Agt4287a;"*OPC?"
150 ENTER @Agt4287a;Buff$
160 !
170 ON INTR Scode GOTO Meas_end
180 ENABLE INTR Scode;2
190 OUTPUT @Agt4287a;":INIT"
200 PRINT "Waiting..."
210 Meas_wait: GOTO Meas_wait
220 Meas_end: OFF INTR Scode
230 PRINT "Measurement Complete"
240 END