Opening A Session; Device Sessions - 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
The visatype .h header file defines most of the VISA types. The VISA
types are used throughout VTL to specify data types used in th e
functions . For example, the viOpenDefaultRM function requires a
pointer to a parameter of type ViSession. If you find viSession in the
visatype .h header file, you will find that viSession is eventually
typed as an unsigned long .
Opening a Session
A session is a channel of communication. Sessions must first be opened
on the default resource manager, and then for each device you will be
using. The following is a summary of sessions that can be opened :
• A resource manager session is used to initialize the VISA system .
It is a parent session that knows about all the opened sessions . A
resource manager session must be opened before any other session
can be opened .
• A device session is used to communicate with a device on a n
interface. A device session must be opened for each device you will be
using. When you use a device session you can communicate without
worrying about the type of interface to which it is connected . This
insulation makes applications more robust and portable acros s
interfaces . Typically a device is an instrument, but could be a
computer, a plotter, or a printer.
NOTE
All devices that you will be using need to be connected and in working
condition prior to the first VTL function call (viOpenDefaultRM) . The
system is configured only on the first viOpenDefaultRM per process .
Therefore, if viOpenDefaultRM is called without devices connected an d
then called again when devices are connected, the devices will not be
recognized. You must close ALL resource manager sessions and re-ope n
with all devices connected and in working condition.
Device Sessions
There are two parts to opening a communications session with a
specific device . First you must open a session to the default resourc e
manager with the viOpenDefaultRM function . The first call to this
function initializes the default resource manager and returns a sessio n
to that resource manager session. You only need to open the defaul t
manager session once. However, subsequent calls to viOpenDefaultR M
returns a session to a unique session to the same default resourc e
manager resource .
Next, you open a session with a specific device with the viOpen
function. This function uses the session returned fro m
viOpenDefaultRM and returns its own session to identify the devic e
session. The following shows the function syntax:
3-8
Chapter 3

Advertisement

Table of Contents
loading

Table of Contents