EasyManua.ls Logo

Agilent Technologies E4438C - Saving and Recalling States Using VISA and C

Agilent Technologies E4438C
208 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
Loading...
Programming Examples
GPIB Programming Examples
Chapter 2 55
Saving and Recalling States Using VISA and C
In this example, instrument settings are saved in the signal generator’s save register. These
settings can then be recalled separately; either from the keyboard or from the signal
generator’s front panel. Launch Microsoft Visual C++ 6.0, add the required files, and enter the
following code into your .cpp source file.
The following program example is available on the ESG 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
// 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");

Table of Contents

Other manuals for Agilent Technologies E4438C

Related product manuals