Programming In C Using The Vtl; Typical Example Program Contents - Keysight N9320B Programmer's Manual

Spectrum analyzer
Hide thumbs Also See for N9320B:
Table of Contents

Advertisement

Programming in C using the VTL

Typical Example Program Contents

visa.h
ViSession
viOpenDefaultRM You must first open a session with the default resource manager with the viOpenDefaultRM
viOpen
viPrintf
viScanf
viWrite
This section includes some basic information about programming
in the C language using Keysight VISA transition library (VTL). Note
that some of this information may not be relevant to your particular
application. For example, if you are not using VXI instruments, the
VXI references will not be relevant.
The following table summaries the VTL function calls used in the
example programs.
This file is included at the beginning of the each file to provide the function prototypes and
constants defined by VTL. For C and C++ programs, you must include the visa.h header file at the
beginning of every file that contains VISA function calls:
#include "visa.h"
The ViSession is a VTL data type. Each object that will establish a communication channel must
be defined as ViSession. Sessions must firstly be opened on the default resource manager, and
then for each resource you will be using.
function, and then for each resource you will be using. This function will initialize the default
resource manager and return a pointer to that resource manager session.
viOpenDefaultRM(&sesn)
This function establishes a communication channel with the device specified. A session identifier
that can be used with other VTL functions is returned. This call must be made for each device you
will be using.
viOpenDefaultRM(&sesn)
viOpen(sesn, rsrcName, accessMode, timeout, &vi)
These are the VTL formatted I/O functions that are patterned after those used in the C
programming language. The viPrintf call sends the SCPI commands to the analyzer. The viPrintf
call can also be used to query the analyzer. The viScanf call is then used to read the results.
This function synchronously sends the data pointed to by buf to the device specified by vi. Only
one synchronous write operation van occur at any one time.
viWrite(vi, buf, count, &retCount)
Programming Example
Programming in C using the VTL
41

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents