Keysight E4428C ESG RF Programming Manual page 112

Signal generators
Table of Contents

Advertisement

Programming Examples
GPIB Programming Interface Examples
Launch Microsoft Visual C++ 6.0, add the required files, and enter the following code into your .cpp
source file. visaex8.cpp performs the following functions:
• error checking
• clears the signal generator
• resets the status byte register
• resets the signal generator
• sets up the signal generator frequency, ALC off, power level, RF output on
• checks for operation complete
• saves to settings to instrument register number one
• recalls information from register number one
• prompts user input to put instrument into Local and checks for operation complete
The following program example is available on the signal generator Documentation CD- ROM as
visaex8.cpp.
//****************************************************************************************
// PROGRAM FILE NAME:visaex8.cpp
//
// PROGRAM DESCRIPTION:In this example, instrument settings are saved in the signal
// generator's registers and then recalled.
// Instrument settings can be recalled from the keyboard or, when the signal generator
// is put into Local control, from the front panel.
// This program will initialize the signal generator for an instrument state, store the
// state to register #1. An *RST command will reset the signal generator and a *RCL
// command will return it to the stored state. Following this remote operation the user
// will be instructed to place the signal generator in Local mode.
//
//****************************************************************************************
#include <visa.h>
#include "StdAfx.h"
#include <iostream>
#include <conio.h>
void main ()
{
ViSession defaultRM, vi;// Declares variables of type ViSession
// for instrument communication
ViStatus viStatus = 0;// Declares a variable of type ViStatus
long lngDone = 0;
viStatus=viOpenDefaultRM(&defaultRM);
// Open session to gpib device at address 19
viStatus=viOpen(defaultRM, "GPIB::19::INSTR", VI_NULL, VI_NULL, &vi);
104
// for GPIB verifications
// Operation complete flag
// Initialize VISA session
Keysight Signal Generators Programming Guide

Advertisement

Table of Contents
loading

Table of Contents