Looping andSynchronization,

Example Program 6

160:Recall the instrument state from register 1. It should contain the sweeping state.

170 to 190: Print a message on the computer display and pause.

200:Recall the instrument state from register 2. It should contain the CW state.

210 and 220: Print messages on the computer display.

Clear and reset the controller and type in the following program:

10Source=719

20ABORT 7

30LOCAL 7

40CLEAR Source

50REMOTE Source

60CLS

70OUTPUT Source;"*RST"

80OUTPUT Source; "FREQ:START 4 GHZ; STOP 5 GHZ; MODE SWEEP"

90OUTPUT Source;"POWER:LEVEL -1 DBM; STATE ON"

100OUTPUT Source;"SWEEP:TIME I"

110OUTPUT Source;"*OPC?"

120ENTER Source;X

130REPEAT

140DISP "Enter number of sweeps to take : CO to exit]";

150

INPUT N

160

IF N>O THEN

170

FOR I=1 TO N

180

DISP "Taking sweep number : ";I

190

OUTPUT Source;"INIT:IMM;*OPC?"

200

ENTER \

210NEXT I

220END IF

230UNTIL N=O

240END

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: Setup the frequency parameters using a compound message.

90:Setup the source’s power level and state using a compound message.

Getting Started Programming 1-95