106 Chapter 2
Programming Examples
RS-232 Programming Examples
RS-232 Programming Examples
• “Interface Check Using Agilent BASIC” on page 106
• “Interface Check Using VISA and C” on page 107
• “Queries Using Agilent BASIC” on page 109
• “Queries Using VISA and C” on page 110
Before Using the Examples
On the signal generator select the following settings:
• Baud Rate - 9600 must match computer’s baud rate
• Transmit Pace - None
• Receive Pace - None
• RTS/CTS - None
• RS-232 Echo - Off
Interface Check Using Agilent BASIC
This example program causes the signal generator to perform an instrument reset. The SCPI command *RST
will place the signal generator into a pre-defined state.
The serial interface address for the signal generator in this example is 9. The serial port used is COM1
(Serial A on some computers). Refer to “Using RS-232” on page 22 for more information.
Watch for the signal generator’s Listen annunciator (L) and the ‘remote preset....’ message on the front panel
display. If there is no indication, check that the RS-232 cable is properly connected to the computer serial
port and that the manual setup listed above is correct.
If the compiler displays an error message, or the program hangs, it is possible that the program was typed
incorrectly. Press the signal generator’s
Reset RS-232 softkey and re-run the program. Refer to “If You Have
Problems” on page 7 for more help.
The following program example is available on the PSG Documentation CD-ROM as rs232ex1.txt.
10 !******************************************************************************
20 !
30 ! PROGRAM NAME: rs232ex1.txt
40 !