High-Level Access Operations

NI-VISA

High-Level Access Operations

The High-Level Access (HLA) operations viInXX() and viOutXX() have a simple and easy-to-use interface for performing register-based communication. The HLA operations in VISA are wholly self-contained, in that all the information necessary to carry out the operation is contained in the parameters of the operation. The HLA operations also perform all the necessary hardware setup as well as the error detection and handling. There is no need to call other operations to do any other activity related to the register access. For this reason, you should use HLA operations if you are just becoming familiar with the system.

To use viInXX() or viOutXX() operations to access a register on a device, you need to have the following information about the register:

  • The address space where the register is located. In a VXI interface bus, for example, the address space can be A16, A24, or A32. In the PXI bus, the device's address space can be the PXI configuration registers or one of the BAR spaces (BAR0-BAR5).
  • The offset of the register relative to the device for the specified address space. You do not need to know the actual base address of the device, just the offset.
Note  When using the VXI MEMACC Resource, you need to provide the absolute VXI address (base + offset) for the register.

The following sample code reads the Device Type register of a VXI device located at offset 0 from the base address in A16 space, and writes a value to the A24 shared memory space at offset 0x20 (this offset has no special significance).

status = viIn16(instr, VI_A16_SPACE, 0, &retValue);
status = viOut16(instr, VI_A24_SPACE, 0x20, 0x1234);

With this information, the HLA operations perform the necessary hardware setup, perform the actual register I/O, check for error conditions, and restore the hardware state. To learn how to perform these steps individually, see the Low-Level Access operations.

The HLA operations can detect and handle a wide range of possible errors. HLA operations perform boundary checks and return an error code (VI_ERROR_INV_OFFSET) to disallow accesses outside the valid range of addresses that the device supports. The HLA operations also trap and handle any bus errors appropriately and then report the bus error as VI_ERROR_BERR.

That is all that is really necessary to perform register I/O. For more examples of HLA register I/O, see the register-based communication example.