Example Program; Including The Visa Declarations File - Agilent Technologies ESA-E Series Programmer's Manual

Esa spectrum analyzers
Hide thumbs Also See for ESA-E Series:
Table of Contents

Advertisement

Programming Examples
C Programming Examples using VT L
C :\VXIPNP\WIN\LIB\MS C
Otherwise, the library and include files should be explicitly specified
in the project file .
Example Program
This example program queries a GPIB device for an identificatio n
string and prints the results . Note that you must change the address i f
something other than the ESA default value of 18 is required .
/*idn .c - program filename * /
#include "visa .h "
#include <stdio .b>
void main ( )
{
/*Open session to HP-IB device at address 18 * /
ViOpenDefaultRM(&defaultRM) ;
ViOpen(defaultRM, "GPIBO : :18 : :INSTR", VI_NULL ,
VI_NULL, &vi) ;
/*Initialize device * /
viPrintf(vi, "*RST\n") ;
/*Send an *IDN? string to the device * /
printf(vi, "*IDN?\n") ;
/*Read results * /
viScanf(vi, "%t", &buf) ;
/*Print results * /
printf("Instrument identification string : %s\n", buf) ;
/* Close the sessions * /
viClose(vi) ;
viClose(defaultRM) ;
}
Including the VISA Declarations Fil e
For C and C++ programs, you must include the
visa .h
header file at
the beginning of every file that contains VTL function calls :
#include "visa .h "
This header file contains the VISA function prototypes and th e
definitions for all VISA constants and error codes. The
visa . h
heade r
file includes the
visatype .h
header file .
Chapter 3
3-7

Advertisement

Table of Contents
loading

Table of Contents