Agilent Technologies 8590 TV Converter Box User Manual


 
Writing Your First Program
When the spectrum analyzer has been connected to a computer via HP-IB or RS-232 interface,
the computer can be used to send instructions to the spectrum analyzer. These instructions tell
the spectrum analyzer such things as frequency span, resolution bandwidth, and sweep mode.
If a properly selected sequence of instructions is sent to the spectrum analyzer, a measurement
is made. Sequences of coded instructions are called programs.
Composing the. Program
Most spectrum analyzer programs contain several common statements, or “commands,” that
address the spectrum analyzer, preset it, and select its sweep mode. As an example, we will
write a short program that executes only these common commands.
The following programs are for the HP-IB and the RS-232 interfaces. Note the quotation marks
that contain spectrum analyzer commands in each line. Also note the semicolons at the end of
each line, inserted at the end of each set of spectrum analyzer commands within the quotation
marks. Using semicolons makes programs easier to read, prevents command misinterpretation,
and is recommended by IEEE Standard 728.
Note
In commands where quotation marks occur, the computer recognizes data as
character data and not BASIC programming language commands.
Program Example for the HP-IB Interface
05
!File:
"IBPROGl"
20 CLEAR Analyzer
30 OUTPUT
Analyzer;"IP;"
40 OUTPUT
Analyzer;"SNGLS;TS;"
50 LOCAL 7
60 END
Line 10 of our program assigns a variable called “Analyzer” to our spectrum analyzer at address
718. This instruction is followed by the HP BASIC CLEAR command, which resets the spectrum
analyzer on the HP-IB. With these two program lines, we have set up a clear communication
path between the computer and the spectrum analyzer.
Line 30 introduces the instrument preset (IP) command, which corresponds to the key
on the spectrum analyzer. The IP command sets all of the analog parameters of the spectrum
Note
All softkey functions on the spectrum analyzer have corresponding
programming commands. As you continue programming, you will learn the
command names that correspond to the front-panel keys and softkeys.
Line 40 activates the single-sweep mode. Most remotely controlled measurements require
control of the sweep. Once SNGLS has activated the single-sweep mode, take sweep (TS)
starts and completes one full sweep. TS maintains absolute control over the sweep, which is
necessary for accurate computer data transfer and reduced program execution time.
Before we end the program, we return the spectrum analyzer to front-panel control with line
50, LOCAL 7. The LOCAL command corresponds to the (LOCAL) key on the front panel
of the spectrum analyzer. (LOCAL 7 commands everything on the bus to go to local mode.)
2-2
Writing a Program