Low-Level Access Functions

NI-VISA

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 the address pointer directly. Otherwise, use the viPeekXX() and viPokeXX() operations to perform register I/O accesses.

National Instruments also provides macros for viPeekXX() and viPokeXX() on certain platforms. The C language macros automatically dereference the pointer whenever possible without calling the driver, which can substantially improve performance. Although the macros can increase performance only on NI-VISA, your application will be binary compatible with other implementations of VISA (the macros will just call the viPeekXX() and viPokeXX() operations). However, the macros are not enabled by default. To use the macros, you must define the symbol NIVISA_PEEKPOKE before including visa.h.