Chapter 2 31
Programming Examples
GPIB Programming Examples
Interface Check using Agilent BASIC
This simple program causes the signal generator to perform an instrument reset. The SCPI command *RST
places the signal generator into a pre-defined state and the remote annunciator (R) appears on the front panel
display.
The following program example is available on the PSG Documentation CD-ROM as basicex1.txt.
10 !******************************************************************************
20 !
30 ! PROGRAM NAME: basicex1.txt
40 !
50 ! PROGRAM DESCRIPTION: This program verifies that the GPIB connections and
60 ! interface are functional.
70 !
80 ! Connect a controller to the signal generator using a GPIB cable.
90 !
100 !
110 ! CLEAR and RESET the controller and type in the following commands and then
120 ! RUN the program:
130 !
140 !******************************************************************************
150 !
160 Sig_gen=719 ! Declares a variable to hold the signal generator's address
170 LOCAL Sig_gen ! Places the signal generator into Local mode
180 CLEAR Sig_gen ! Clears any pending data I/O and resets the parser
190 REMOTE 719 ! Puts the signal generator into remote mode
200 CLEAR SCREEN ! Clears the controllers display
210 REMOTE 719
220 OUTPUT Sig_gen;"*RST" ! Places the signal generator into a defined state
230 PRINT "The signal generator should now be in REMOTE."
240 PRINT
250 PRINT "Verify that the remote [R] annunciator is on. Press the `Local' key, "
260 PRINT "on the front panel to return the signal generator to local control."
270 PRINT