Chapter 2 2-15
Introduction to Instrument Control
Instrument Control using HP BASIC
ON/OFF commands can be also be queried. The reply is a one (1) if the function is active, a
zero (0) if it is not active. Similarly, if a command controls a function that is underlined on
the analyzer softkey menu when active, querying that command yields a one (1) if the
command is underlined, a zero (0) if it is not. For example, press . Though there are
seven options on the measurement menu, only one is underlined at a time. The underlined
option will return a one (1) when queried.
For instance, rewrite line 10 as:
10 OUTPUT 716;"DUAC?;"
Run the program once and note the result. Then press to
toggle the display mode, and run the program again.
Another example is to rewrite line 10 as:
10 OUTPUT 716;"PHAS?;"
In this case, the program will display a one (1) if phase is currently being displayed. Since
the command only applies to the active channel, the response to the PHAS? inquiry
depends on which channel is active.
Operation Complete
Occasionally, there is a need to query the analyzer as to when certain analyzer operations
have completed. For instance, a program should not have the operator connect the next
calibration standard while the analyzer is still measuring the current one. To provide such
information, the analyzer has an “operation complete” reporting mechanism, or OPC
command, that will indicate when certain key commands have completed operation. The
mechanism is activated by sending either OPC or OPC? immediately before an
OPC-compatible command. When the command completes execution, bit 0 of the
event-status register will be set. If OPC was queried with OPC?, the analyzer will also
output a one (1) when the command completes execution.
As an example, type SCRATCH and press .
Type EDIT and press .
Type in the following program:
10 OUTPUT 716;"SWET 3 S;OPC?;SING;"
Set the sweep time to 3 seconds, and OPC a single sweep.
20 DISP "SWEEPING"
30 ENTER 716;Reply The program will halt at this point until the analyzer
completes the sweep and issues a one (1).
40 DISP "DONE"
50 END
Meas
Local Display
Return
Return