Register-Based Communication Introduction

NI-VISA

Introduction

Register-based devices (RBDs) are a class of devices that are simple and relatively inexpensive to manufacture. Communication with such devices is usually accomplished via reads and writes to registers. VISA has the ability to read from and write to individual device registers, as well as a block of registers, through the Memory I/O Services.

In addition to accessing RBDs, VISA also provides support for memory management of the memory exported by a device. For example, both local controllers and remote devices can have general-purpose memory in A24/A32 space. With VISA, although the user must know how each remote device accesses its own memory, the memory management aspects of local controllers are handled through the Shared Memory operations—viMemAlloc() and viMemFree(). For more information on this topic, refer to Shared Memory Operations.

With the Memory I/O Services, you access the device registers based on the session to the device. In other words, if a session communicates with a device at VXI logical address 16, you cannot use Memory I/O Services on that session to access registers on a device at any other logical address. The range of address locations you can access with Memory I/O Services on a session is the range of address locations assigned to that device. This is true for both High-Level and Low-Level Access operations.

To facilitate access to the device registers for multiple VXI devices, VISA allows you to open a VXI MEMACC (memory access) session. A session to a VXI MEMACC Resource allows an application to access the entire VXI memory range for a specified address space. The MEMACC Resource supports the same high-level and low-level operations as the INSTR Resource. Programmatically, the main difference between a VXI INSTR session and a VXI MEMACC session is the value of the offset parameter you pass to the register based operations. When using an INSTR Resource, all address parameters are relative to the device's assigned memory base in the given address space; knowing a device's base address is neither required by nor relevant to the user. When using a MEMACC Resource, all address parameters are absolute within the given address space; knowing a device's base address is both required by and relevant to the user.

Note  A session to a MEMACC Resource supports only the high-level, low-level, and resource template operations. A MEMACC session does not support the other INSTR operations.

In VISA, you can choose between two styles for accessing registers—High-Level Access or Low-Level Access. Both styles have operations to read the value of a device register and write to a device register, as shown in the following table. In addition, there are high-level operations designed to read or write a block of data. The block-move operations do not have a low-level counterpart.

High-Level Access High-Level Block Low-Level Access
Read viIn8()
viIn16()
viIn32()
viMoveIn8()
viMoveIn16()
viMoveIn32()
viPeek8()
viPeek16()
viPeek32()
Write viOut8()
viOut16()
viOut32()
viMoveOut8()
viMoveOut16()
viMoveOut32()
viPoke8()
viPoke16()
viPoke32()
Note  The other register-based communication topics use XX in the names of some operations to denote that the information applies to 8-bit, 16-bit, and 32-bit reads and writes. For example, viInXX() refers to viIn8(), viIn16(), and viIn32().