190 NEXT I
200 PRINT “Finished sending commands to source.
‘I
210 PRINT “Note that execution is continuing for four cycles.”
220 END
Run the program.
Program Comments
10: Assign the source’s HP-IB address to a variable.
20 to 50: Abort any HP-IB activity and initialize the HP-IB
interface.
60: Clear the computer’s display.
70: Set the source to its initial state for programming.
80: Set the source up for a sweep, from 4 GHz to 5 GHz.
90: Set the sweep time to 2 second. In SCPI, suffixes are optional
if you program in fundamental units (for sweep time, that would
be seconds).
100: Send an
‘OPC?
to the source.
110: Enter the query response to the *OPC? into a variable “X”.
The program execution will halt here until the source has finished
processing all the commands up to this point. Once complete, the
source will respond to the *OPC? with a “1”.
120: Begin a FOR/NEXT loop that is repeated four times.
130: Initiate a sweep on the source.
140: Send a
*WA1
command to the source. This command
causes the source to stop executing new commands until all prior
commands and operations have completed execution. In this case,
there is a sweep in progress, so no further commands will be
executed until the sweep finishes.
150: Turn the RF output of the source ON.
160: Initiate a sweep on the source.
170: Send another
*WA1
to the source. Although the
*WA1
command causes EXECUTION of commands to be held off, it
has no effect on the transfer of commands over the HP-IB. The
commands continue to be accepted by the source and are buffered
until they can be executed.
180: Toggle the RF STATE to OFF.
190: Repeat the sample exercise.
200 and 210: Print messages on the computer display.
Getting Started Programming 1-97