R3132 Series Spectrum Analyzer Operation Manual
4.2.10 Example Programs
4-49
4.2.10 Example Programs
This section describes remote control examples used with GPIB port.
4.2.10.1 Sample Programs for Setting or Reading Measurement Conditions
CAUTION
Visual Basic 4.0 (referred to as VB henceforth) is used in the sample programs shown here. Also,
National Instruments-made GPIB board (referred to as NI-made for brevity henceforth) is used
for the GPIB control board; NI-made driver is used for the control driver.
•
Program examples using VB
Example VB-1: Setting the center frequency after performing an analyzer master reset
Call ibclr(spa)
’ Performs a Device Clear.
Call ibwrt(spa, "IP")
’ preset
Call ibwrt(spa, "CF 30MZ")
’ Set the center frequency to 30 MHz.
Example VB-2: Setting the start frequency to 300 kHz, setting the stop frequency to 800 kHz and adding
50 kHz to the frequency offset.
Call ibclr(spa)
’ Performs a Device Clear.
Call ibwrt(spa, "FA 300KZ")
’ Set the start frequency to 300 kHz.
Call ibwrt(spa, "FB 800KZ")
’ Set the stop frequency to 800 kHz.
Call ibwrt(spa, "FO 50KZ")
’ Add 50 kHz to the frequency offset.
Example VB-3: Setting the reference level to 87 dB
µ
V (in 5 dB/div) and the RBW to 100 kHz
Call ibclr(spa)
’ Performs a Device Clear.
Call ibwrt(spa, "AUNITS DBUV")
’ Set the level unit to dB
µ
V.
Call ibwrt(spa, "RL 87DB")
’ Set the reference level to 87 dB (
µ
V).
Call ibwrt(spa, "DD 5DB")
’ Set the vertical gradation to 5 dB/div.
Call ibwrt(spa, "RB 100KZ")
’ Set the RBW to 100 kHz.
Example VB-4: Setting the instrument using variables
Dim A As String
Dim B As String
Dim C As String
A = "10"
’ Set the character string.
B = "2"
C = "20"
Call ibclr(spa)
’ Performs a Device Clear.
Call ibwrt(spa, "CF " & A & "MZ")
’ Set the start frequency to A MHz.
Call ibwrt(spa, "SP " & B & "MZ")
’ Set the span frequency to B MHz.
Call ibwrt(spa, "AT " & C & "DB")
’ Set the ATT to C dB.