Agilent Technologies E8663B Portable Generator User Manual


 
86 Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Programming Examples
GPIB Programming Interface Examples
The following program example is available on the signal generator Documentation CD-ROM as
visaex11.cpp.
//************************************************************************
// PROGRAM FILE NAME: visaex11.cpp
//
// PROGRAM DESCRIPTION: This program sets up the signal generator to
// sweep from 1-2 GHz. A loop and counter are used to generate 5 sweeps.
// Each sweep consists of 101 points with a .01 second dwell at each point.
//
// The program uses a Sleep function to allow the signal generator to
// complete it's sweep operation before the INIT command is sent.
// The Sleep function is available with the windows.h header file which is
// included in the project.
//
// NOTE: Change the TCPIP0 address in the instOpenString declaration to
// match the IP address of your signal generator.
//
//************************************************************************
#include "stdafx.h"
#include "visa.h"
#include <iostream>
#include <windows.h>
void main ()
{
ViStatus stat;
ViSession defaultRM,inst;
int npoints = 101;
double dwell = 0.01;
int intCounter=5;
char* instOpenString = "TCPIP0::141.121.93.101::INSTR";
stat = viOpenDefaultRM(&defaultRM);
stat = viOpen(defaultRM,instOpenString,VI_NULL,VI_NULL, &inst);
// preset to start clean
stat = viPrintf( inst, "*RST\n" );
// set power level for -10dBm
stat = viPrintf(inst, "POW -10DBM\n");