R3131 Spectrum Analyzer Operation Manual
4.1 GPIB Remote Programming
4-45Aug 28/98
Example HP-17: Read both the peak frequency and the level at the end of a single sweep (when
using SRQ signal).
10 Spa=708 ! Set GPIB address (8) in a variable.
20 OUTPUT Spa;”SI” ! Set in single sweeping mode.
30 ON INTR 7 GOSUB Ssrq ! Define the SRQ interrupt processing
routine.
40 OUTPUT Spa;”*CLS” ! Clear the status byte.
50 OUTPUT Spa;”OPR8” ! Make the Sweep-end bit of the
60 ! operation status register enable.
70 OUTPUT Spa;”*SRE128” ! Make the Operation Status bit of
80 ! the status byte enable.
90 OUTPUT Spa;”S0” ! Specify the sending out mode of SRQ
signal.
100 Mloop: !
110 Mend=0 ! Clear the Sweep-end flag.
120 OUTPUT Spa;”SR” ! Begin the sweeping.
130 ENABLE INTR 7;2 ! Make the SRQ interruption enable.
140 Wint: !
150 IF Mend=0 TEHN GOTO Wint ! Wait until SRQ interruption occurs.
160 OUTPUT Spa;”PS” ! Execute the peak search.
170 OUTPUT Spa;”MFL?” ! Request the output of the marker data.
180 ENTER Spa;MF,ML ! Read the peak frequency and the level.
190 PRINT ”Peak Freq:”;MF;” ,Peak Level:”;ML ! Display the read data.
200 GOTO Mloop ! Repeat the sweeping.
210 !
220 Ssrq: ! SRQ interrupt processing routine.
230 S=SPOLL(Spa) ! Read the status byte.
240 Mend=1 ! Set the Sweep-end flag in one.
250 RETURN ! Return to the main routine.
260 !
270 END