102 Keysight CXG, EXG, and MXG X-Series Signal Generators Programming Guide
Programming Examples
GPIB Programming Interface Examples
// 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
// for GPIB verifications
long lngDone = 0; // Operation complete flag
viStatus=viOpenDefaultRM(&defaultRM); // Initialize VISA
session
// 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);}
printf("\n");
viClear(vi); // Clears the signal
generator
viPrintf(vi, "*CLS\n"); // Resets the status byte
register
// Print user information
printf("Programming example using the *SAV,*RCL SCPI
commands\n");
printf("used to save and recall an instrument's state\n");
Summary of Contents for X-Series
Page 4: ...4 ...
Page 10: ...10 Contents ...