Agilent Technologies N5183A MXG User Manual
Page 90
80
Agilent N518xA, E8663B, E44x8C, and E82x7D Signal Generators Programming Guide
Programming Examples
GPIB Programming Interface Examples
Launch Microsoft Visual C++ 6.0, add the required files, and enter the code into your .cpp source file.
visaex5.cpp
performs the following functions:
•
error checking
•
resets the signal generator
•
sets up the EXT 2 connector on the signal generator for FM
•
sets up FM path 2 coupling to AC
•
sets up FM path 2 deviation to 20 kHz
•
sets carrier frequency to 700 MHz
•
sets the power level to - 2.5 dBm
•
turns on frequency modulation and RF output
The following program example is available on the signal generator Documentation CD- ROM as
visaex5.cpp
.
//****************************************************************************************
// PROGRAM FILE NAME:visaex5.cpp
//
// PROGRAM DESCRIPTION:This example sets the signal generator FM source to External 2,
// coupling to AC, deviation to 20 kHZ, carrier frequency to 700 MHz and the power level
// to -2.5 dBm. The RF state is set to on.
//
//****************************************************************************************
#include
#include "StdAfx.h"
#include
#include
#include
void main ()
{
ViSession defaultRM, vi; // Declares variables of type ViSession
// for instrument communication
ViStatus viStatus = 0;
// Declares a variable of type ViStatus
// for GPIB verifications
// Initialize VISA session
viStatus=viOpenDefaultRM(&defaultRM);
// open session to gpib device at address 19
viStatus=viOpen(defaultRM, "GPIB::19::INSTR", VI_NULL, VI_NULL, &vi);
if(viStatus){ // If problems, then prompt user
printf("Could not open ViSession!\n");
printf("Check instruments and connections\n");
printf("\n");
exit(0);}