R3131 Spectrum Analyzer Operation Manual
4.1 GPIB Remote Programming
4-44 Aug 28/98
(2) Sample Programs for HP200, HP300 series (GPIB address = 8)
Example HP-15: Execute a single sweep and wait the end of the sweeping (when not using SRQ
signal).
Example HP-16: Execute ACP measurement and begin reading the result after the measurement is
ended (when not using SRQ signal).
10 Spa=708 ! Set GPIB address (8) in a variable.
20 OUTPUT Spa;”SI” ! Set in the single sweeping mode.
30 OUTPUT Spa;”OPR8” ! Make the Sweep-end bit of the
40 ! operation status register enable.
50 OUTPUT Spa;”*CLS” ! Clear the status byte.
60 OUTPUT Spa;”SR” ! Begin the sweeping.
70 Mloop:!
80 OUTPUT Spa;”*STB?” ! Request the output of the status byte.
90 ENTER Spa;S ! Read the status byte.
100 IF BIT (S,7)=0 THEN GOTO Mloop ! Wait until the operation status bit
110 ! (end of sweeping) is set in one.
120 STOP
130 END
10 Spa=708 ! Set GPIB address (8) in a variable.
20 OUTPUT Spa;”CF1500MZ” ! Set the center frequency to 1500 MHz.
30 OUTPUT Spa;”SP250KZ” ! Set the frequency span to 250kHz.
40 OUTPUT Spa;”RB1KZ;VB10KZ” ! Set RBW to 1kHz and VBW to 10kHz.
50 OUTPUT Spa;”ST20SC” ! Set the sweeping time at 20 seconds.
60 OUTPUT Spa;”DTP” ! Set the detector mode to positive.
70 OUTPUT Spa;”ADCH50KZ” ! Set the channel space to 50kHz.
80 OUTPUT Spa;”ADBS21KZ” ! Set the bandwidth to 21kHz.
90 OUTPUT Spa;”OPR8” ! Make the sweep-end bit of the
100 ! operation status register enable.
110 OUTPUT Spa;”*CLS” ! Clear the status byte.
120 OUTPUT Spa;”SI” ! Set in the single sweeping mode.
130 OUTPUT Spa;”ACP” ! Begin ACP measurement.
140 OUTPUT Spa;”*SR” ! Begin the sweeping.
150 Mloop:
160 OUTPUT Spa;”*STB?” ! Request the output of the status byte.
170 ENTER Spa;S ! Read the status byte.
180 IF BIT(S, 7)=0 THEN GOTO Mloop ! Wait the end of ACP measurement.
190 OUTPUT Spa;”ACP?” ! Request the output of the ACP measurement
result.
200 ENTER Spa;”Lo,Up ! Read the ACP measurement result.
210 PRINT”-50K:”;Lo;”,+50K:”;Up ! Display the measurement result.
220 END !