Register-Based Programming with the GPIB-VXI

NI-VISA

Register-Based Programming with the GPIB-VXI

Register-based programming does not have a straightforward mapping. Because register accesses using the GPIB-VXI involve sending requests to the controller itself (using the local command set), NI-488.2 programs would use ibdev() with the GPIB-VXI controller's primary and secondary GPIB addresses. In VISA, you call viOpen() with the VXI device's logical address, the same method for both message-based and register-based devices, and VISA handles sending the necessary messages to the controller. For programming the device, the following NI-488.2 messages and VISA operations are roughly equivalent:

Register-Based Programming Messages and Operations

NI-488.2 Message VISA Operation
"Laddrs?" or "DLAD?" viFindRsrc()
"RMentry?" or "DINF?" viGetAttribute()
"Cmdr?" viGetAttribute() with VI_ATTR_CMDR_LA
"LaSaddr?" viGetAttribute() with VI_ATTR_GPIB_SECONDARY_ADDR
"Primary?" viGetAttribute() with VI_ATTR_GPIB_PRIMARY_ADDR
"WREG" or "A16" viOut16() with VI_A16_SPACE
"RREG?" or "A16?" viIn16() with VI_A16_SPACE
"A24" viOut16() with VI_A24_SPACE
"A24?" viIn16() with VI_A24_SPACE
"SrcTrig" viAssertTrigger()

Notice that with the INSTR register access operations viOut16() and viIn16(), you pass a device-relative offset in the specified address space. This is different from the GPIB-VXI/C local command set, which accepts absolute addresses. If your application currently uses absolute addressing and you do not want to convert to device-relative offsets, you may consider the MEMACC resource, which accepts absolute addressing. The form of the resource string for that class is "GPIB-VXI<system>::MEMACC". You can also use the operations viOut8() and viIn8() to perform 8-bit accesses, which is not a feature supported by the local command set. VISA also defines 32-bit operations and accesses to A32 space, but because these are not implemented by the GPIB-VXI/C itself, they return errors.

If you have used the DMAmove code instrument in the past, you can instead use the viMoveInxx() and viMoveOutxx() operations instead. They make use of the GPIB-VXI's DMA functionality, but require only a single operation call, instead of the multiple calls required to send the command and data blocks and then poll waiting for the operation to complete. Using VISA to move blocks of data also means that you no longer need to load the DMAmove code instrument, as NI-VISA automatically downloads a separate code instrument to handle these and other operations.