Agilent Technologies E8663B Portable Generator User Manual


 
50 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Using IO Interfaces
RS-232 Programming Interface Examples
RS-232 Programming Interface Examples
NOTE The portions of the programming examples discussed in this section are taken from the full
text of these programs that can be found in Chapter 3, “Programming Examples.”
“Interface Check Using HP BASIC” on page 50
“Interface Check Using VISA and C” on page 51
“Queries Using HP Basic and RS-232” on page 51
“Queries for RS-232 Using VISA and C” on page 52
Before Using the Examples
Before using the examples: On the signal generator select the following settings:
Baud Rate - 9600 must match computer’s baud rate
RS-232 Echo - Off
The following sections contain HP Basic and C lines of programming removed from the programming
interface examples in Chapter 3, Programming Examples,, these portions of programming demonstrate
the important features to consider when developing programming for use with the RS-232 interface.
NOTE For RS-232 programming examples, refer to “RS-232 Programming Interface Examples
(ESG/PSG/E8663B Only)” on page 131.
Interface Check Using HP BASIC
This portion of the example program “Interface Check Using HP BASIC” on page 50, 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 (ESG, PSG, and E8663B Only)” on
page 45 for more information.
The following program example is available on the signal generator’s Documentation CD-ROM as
rs232ex1.txt. For the full text of this program, refer to “Interface Check Using HP BASIC” on
page 131 or to the signal generator’s documentation CD-ROM.
170 CONTROL 9,0;1 ! Resets the RS-232 interface
180 CONTROL 9,3;9600 ! Sets the baud rate to match the sig gen
190 STATUS 9,4;Stat ! Reads the value of register 4
200 Num=BINAND(Stat,7) ! Gets the AND value
210 CONTROL 9,4;Num ! Sets parity to NONE
220 OUTPUT 9;"*RST" ! Outputs reset to the sig gen