Using NI-VISA to Communicate with a PXI/PCI Device

NI-VISA

Using NI-VISA to Communicate with a PXI/PCI Device

Now that you can communicate with your device using NI-VISA, you will see a simple programming example to help you get started programming your device using the NI-VISA API. In the example, the PXI-6070E is programmed to toggle a few of its digital lines. The example demonstrates how to open a VISA session, map a portion of memory, peek and poke registers on the device, and close the VISA session both in LabVIEW and LabWindows/CVI.

NI-VISA provides high-level and low-level register accesses. The valid address spaces for a PXI device are the configuration registers (VI_PXI_CFG_SPACE) and the six Base Address Registers (VI_PXI_BAR0_SPACEVI_PXI_BAR5_SPACE). A device may use any or all of the BARs. This information is device dependent, but can be queried through the VISA attributes VI_ATTR_PXI_MEM_TYPE_BAR0VI_ATTR_PXI_MEM_TYPE_BAR5. The values for these attributes are none (0), memory mapped (1), or I/O (2). If the value is memory mapped or I/O, you can also query the appropriate attributes for the base and size of each region. The functions in LabVIEW and LabWindows/CVI for obtaining VISA attributes are introduced in the following topics:

Step 1—Initialize the Device

Step 2—Communicating with the PXI Device

Step 3—Closing the Device