![HP E4401B Скачать руководство пользователя страница 71](http://html.mh-extra.com/html/hp/e4401b/e4401b_programmers-manual_161548071.webp)
Chapter 3
3-7
Programming Examples
C Programming Examples using VTL
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 an
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 across
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 and
then called again when devices are connected, the devices will not be
recognized. You must close ALL resource manager sessions and re-open
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 resource
manager with the
viOpenDefaultRM
function. The first call to this
function initializes the default resource manager and returns a session
to that resource manager session. You only need to open the default
manager session once. However, subsequent calls to
viOpenDefaultRM
returns a session to a unique session to the same default resource
manager resource.
Next, you open a session with a specific device with the
viOpen
function. This function uses the session returned from
viOpenDefaultRM
and returns its own session to identify the device
session. The following shows the function syntax:
viOpenDefaultRM (sesn);
viOpen (sesn, rsrcName, accessMode, timeout, vi);
The session returned from
viOpenDefaultRM
must be used in the sesn
parameter of the
viOpen
function. The
viOpen
function then uses that
session and the device address specified in the (resource name)
parameter to open a device session. The vi parameter in
viOpen
returns
Содержание E4401B
Страница 6: ...vi ...
Страница 14: ...xiv Contents ...
Страница 64: ...2 34 Chapter2 HP ESA Status Registers Using the Analyzer Status Registers ...
Страница 65: ...3 1 3 Programming Examples ...
Страница 118: ...3 54 Chapter3 Programming Examples Entering Amplitude Correction Data Close the session viClose viESA viClose defaultRM ...
Страница 151: ...4 1 4 Programming Command Cross References ...
Страница 286: ...5 132 Chapter5 Language Reference UNIT Subsystem ...
Страница 287: ...6 1 6 HP 8590 HP ESA Spectrum Analyzers Programming Conversion Guide ...
Страница 292: ...1 HP 8590 HP ESA Spectrum Analyzers Conversion Guide ...
Страница 368: ...7 1 7 Error Messages ...
Страница 393: ...7 26 Chapter7 Error Messages 201 to 799 Device Specific Errors ...