Download NI-VISA User Manual - National Instruments

Transcript
NIVISAUM.book Page 2 Thursday, October 4, 2001 5:10 PM
Chapter 10
NI-VISA Platform-Specific and Portability Issues
Programming Considerations
This section contains information for you to consider when developing
applications that use the NI-VISA I/O interface software.
NI Spy: Debugging Tool for Windows
NI Spy tracks the calls your application makes to National Instruments
test and measurement (T&M) drivers, including NI-VXI, NI-VISA,
and NI-488.2.
NI Spy highlights functions that return errors, so you can quickly determine
which functions failed during your development. NI Spy can also log your
program’s calls to these drivers into a file so you can check them for errors
at your convenience.
Multiple Applications Using the NI-VISA Driver
Multiple-application support is an important feature in all implementations
of the NI-VISA driver. You can have several applications that use NI-VISA
running simultaneously. You can even have multiple instances of the same
application that uses the NI-VISA driver running simultaneously, if your
application is designed for this. The NI-VISA operations perform in the
same manner whether you have only one application or several applications
(or several instances of an application) all trying to use the NI-VISA driver.
However, you need to be careful when you have multiple applications or
sessions using the low-level bus access functions. The memory windows
used to access the bus are a limited resource. Call the viMapAddress()
operation before attempting to perform low-level bus access with
viPeekXX() or viPokeXX(). Immediately after the accesses are
completed, always call the viUnmapAddress() operation so that you free
up the memory window for other applications.
Low-Level Access Functions
The viMapAddress() operation returns a pointer for use with low-level
access functions. On some systems, such as the VXIpc embedded
computers, it is possible to directly dereference this pointer. However, on
other systems such as the GPIB-VXI, you must use the viPeekXX() and
viPokeXX() operations. To make your source code portable between
these and other platforms, and even other implementations of VISA, check
the attribute VI_ATTR_WIN_ACCESS after calling viMapAddress().
If the value of that attribute is VI_DEREF_ADDR, you can safely dereference
NI-VISA User Manual
10-2
ni.com