Programming PXI Devices in NI-VISA

NI-VISA supports programming PCI and PXI (PCI eXtensions for Instrumentation) devices plugged into the local PC or PXI chassis, or PXI devices in a remote chassis connected via a remote controller such as MXI-3

Users who are writing an application for a PCI or PXI card can use NI-VISA to gain full access to all the device's configuration, I/O, and memory-mapped registers. NI-VISA currently supports the PXI interface on Windows, LabVIEW RT (Phar Lap ETS), and Linux. The supported functionality is identical for PCI and PXI cards. The terms PCI and PXI are used somewhat interchangeably in this section; technically, PXI is a rigorously defined extension of PCI.

To use PXI or PCI devices in your program, make sure you define the macro "NIVISA_PXI" before including "visa.h".

A PXI resource is uniquely identified in the system by three characteristics: the PCI bus number on which it is located, the PCI device number it is assigned, and the function number of the device. For single-function devices, the function number is always 0 and is optional; for multifunction devices, the function number is device specific but will be in the range 0–7. The device number is associated with the slot number, but these numbers are usually different. The bus number of a device is consistent from one system boot to the next, unless bridge devices are inserted somewhere between the device and the system's CPU. The canonical resource string that you pass to viOpen() for a PCI or PXI device is "PXI<bus>::<device>::<function>::INSTR", but based on the previous explanation, this can be difficult to determine.

A better way to determine the resource string is to query the system with viFindRsrc() and use or display the resource(s) returned from that operation. Each PCI device has a vendor code and a model code; this is much the same as VXI does, although the vendor IDs are different. You can create a query to search for devices of a particular attribute value; in this case, you can search for a specific vendor ID and model code. For example, the PCI vendor ID for National Instruments is 0x1093. If NI made a device with the model code 0xBEEF, you could call viFindRsrc() with the expression "PXI?*INSTR{VI_ATTR_MANF_ID==0x1093 && VI_ATTR_MODEL_CODE==0xBEEF}". In many cases, the returned list has one or only a few devices.

NI-VISA provides a convenient means of accessing advanced functionality of PCI and PXI devices. The alternative to using NI-VISA for PCI or PXI device communication is writing a kernel driver. By using NI-VISA, you avoid having to learn how to write kernel drivers, you avoid having to learn a different kernel model for each Windows operating system, and you gain platform independence and portability by scaling to other operating systems such as LabVIEW RT now and others in the future.