Queries, Example
Program 4
The following example demonstrates the use of query commands and
response data formats. Clear and reset the controller and type in the
following program:
10 Source=719
20 ABORT 7
30 LOCAL 7
40 CLEAR Source
50 REMOTE Source
60 CLS
70 OUTPUT Source;"*RST"
80 OUTPUT Source;"POWER:LEVEL -5 dBm;STATE ON"
90 OUTPUT Source;"FREQ:CW?"
100 ENTER Source;F
110 PRINT "Present source CW frequency is : ";F/1.E+6;"MHz"
120 OUTPUT Source;"POWER:STATE?"
130 ENTER Source;W
140 PRINT "Present power ON/OFF state is : ";W
150 OUTPUT Source;"FREQ:MODE?"
160 DIM A$[10]
170 ENTER Source;A$
180 PRINT "Source's frequency mode is : "&A$
190 OUTPUT Source;"FREQ:CW? MIN"
200 ENTER Source;A
210 PRINT "Minimum source CW frequency is : ";A/1.E+6;"MHz"
220 OUTPUT Source;"FREQ:START?;STOP?"
230 ENTER Source;X,Y
240 PRINT "Swept frequency limits :"
250 PRINT " Start ";X/1.E+6;"MHz"
260 PRINT " Stop ";Y/1.E+6;"MHz"
270 END
Run the program.
Program Comments
10: Assign the source's GPIB address to a variable.
20 to 50: Ab ort any GPIB activity and initialize the GPIB
interface.
60: Clear the computer's display.
70: Set the source to its initial state for programming.
80: Set up the source p ower level using a comp ound message.
90: Query the value of the source's CW frequency.
100: Enter the query resp onse into the variable 'F'. The response
always is returned in fundamental units, Hz in the case of
frequency.
110: Print the CW Frequency in MHz on the computer display.
120: Query the value of a Bo olean function, POWER:STATE.
Getting Started Programming 1-95