EasyManuals Logo

Keysight E4428C ESG RF User Manual

Keysight E4428C ESG RF
404 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #75 background imageLoading...
Page #75 background image
Keysight Signal Generators Programming Guide 67
Using IO Interfaces
RS–232 Programming Interface Examples
Interface Check Using HP BASIC
This portion of the example program “Interface Check Using HP BASIC” on page 67, 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 and PSG Only)” on page 61 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 153 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
Interface Check Using VISA and C
This portion of the example program “Interface Check Using VISA and C” on page 67, uses VISA library
functions to communicate with the signal generator. The program verifies that the RS–232
connections and interface are functional. In this example the COM2 port is used. The serial port is
referred to in the VISA library as ‘ASRL1’ or ‘ASRL2’ depending on the computer serial port you are
using.
The following program example is available on the signal generator Documentation CD–ROM as
rs232ex1.cpp. For the full text of this program, refer to “Interface Check Using VISA and C” on page 154
or to the signal generator’s documentation CD–ROM.
int baud=9600;// Set baud rate to 9600
ViSession defaultRM, vi;// Declares a variable of type ViSession
// for instrument communication on COM 2 port
ViStatus viStatus = 0;
// Opens session to RS-232 device at serial port 2
viStatus=viOpenDefaultRM(&defaultRM);
viStatus=viOpen(defaultRM, "ASRL2::INSTR", VI_NULL, VI_NULL, &vi);
viStatus=viEnableEvent(vi, VI_EVENT_IO_COMPLETION, VI_QUEUE,VI_NULL);
viClear(vi);// Sends device clear command
// Set attributes for the session
viSetAttribute(vi,VI_ATTR_ASRL_BAUD,baud);
viSetAttribute(vi,VI_ATTR_ASRL_DATA_BITS,8);

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Keysight E4428C ESG RF and is the answer not in the manual?

Keysight E4428C ESG RF Specifications

General IconGeneral
BrandKeysight
ModelE4428C ESG RF
CategoryPortable Generator
LanguageEnglish

Related product manuals