Technical data
Chapter 9 141
Programming Examples
Programming in C Using the VISA
Programming Examples
Typical Example Program Contents
The following is a summary of the VISA function calls used in the
example programs.
visa.h This file is included at the beginning of the file to
provide the function prototypes and constants defined
by VISA.
ViSession The ViSession is a VISA data type. Each object that
will establish a communication channel must be
defined as ViSession.
viOpenDefaultRM You must first open a session with the default
resource manager with the viOpenDefaultRM
function. This function will initialize the default
resource manager and return a pointer to that resource
manager session.
viOpen This function establishes a communication channel
with the device specified. A session identifier that can
be used with other VISA functions is returned. This call
must be made for each device you will be using.
viPrintf
viScanf These are the VISA formatted I/O functions that are
patterned after those used in the C programming
language. For example, the viPrintf call sends the
IEEE 488.2 *RST command to the instrument to put it
in a known state. The viPrintf call is used again to
query for the device identification (*IDN?). The
viScanf call is then used to read the results.
viClose This function must be used to close each session. When
you close a device session, all data structures that had
been allocated for the session will be de-allocated.
When you close the default manager session, all
sessions opened using the default manager session will
be closed.