|| 2.90 out of 5
Programmatic PXI Slot Detection
I have a PXI system with multiple PXI cards. I want to discover the model, manufacturer, slot number, or serial number of the card in my LabVIEW program. How can I programmatically determine what PXI modules I have and in which slot number they are installed?
PXI uses the PCI bus. Every PCI board saves in its configuration registers the model number, the manufacturer and other specific information. This document explains how to get specific information from PXI boards using NI-DAQmx, NI-VISA, and the Windows registry.
NI-VISA 3.0 and above
Related Links: Knowledge Base 1EGB71UI: What Are PXISYS.INI and CHASSIS.INI? KnowledgeBase 2CFE965P: Slot Detection of PXI Modules KnowledgeBase 2CMCAHLS: How Can I Get the "PXI System" Entry Back in MAX? KnowledgeBase 2IJ896LS: What is the Format of VISA Resources for PXI Devices KnowledgeBase 2E1AJUQI: Correlation of PXI DAQ Device Number to PXI Slot Number Example Program: Programmatic Slot Detection of PXI Instruments
If you are using NI-VISA 3.0 or above, you can simply use the "Slot" property to determine the slot number of your PXI device. In LabVIEW, open a VISA session to your PXI device using the VISA Open function from the VISA Advanced palette. Once the session is open, use a property node to access the "Slot" property. This property is one of the "Registry Based Settings" properties. This method is demonstrated in the Example Program: Programmatic Slot Detection of PXI Instruments.
- You must be using NI-VISA 3.0 or above.
- Install the appropriate PXISYS.INI file in the Windows System Directory. See more information about this in KnowledgeBase 2CFE965P: Slot Detection of PXI Modules
- Enable PXI VISA in the Measurement & Automation Explorer (MAX). To do this, launch MAX, go to the menu Tools»NI-VISA»VISA Options. In the "General" Tab select "Show all PXI/PCI devices accessible to VISA", and in the "Passport" Tab select NiVIPxi.dll. Now select View»Refresh.
- After installing any new board in the system, launch MAX and go to View»Refresh.
- This is by far the easiest method because it only requires a single property node.
- The relationship between the Logical Device Number assigned by the driver and the slot number is not known (unless the boards use the NI-DAQ driver).
- VISA properties do not display the serial number.
- According to the PXI specifications, every PXI controller MUST support VISA, but not every driver of PXI boards must support VISA. This means that you will only be able to find the slot where PXI boards are installed using this method if, and only if, their driver supports VISA and their PXI VISA Resource Name uses the PCI Bus Number and PCI Device Number. Currently, the drivers for National Instruments Data Acquisition boards, Modular Instrumentation boards, and Switch boards do support the PXI VISA Resource Names.
- PXI-GPIB boards and PXI-Serial boards do not have PXI VISA Resource Names, instead they show the GPIBx::y::INSTR and ASRLx::y::INSTR Resource Names respectively, where x and y do not have any relationship with the PCI Bus Number and PCI Device Number
NI-VISA 2.6 and below
To identify the slot number where a PXI board is installed in a PXI chassis, it is necessary to map the information in the PXI System Initialization file (PXISYS.INI), with the PCI Bus Number and PCI Device Number that the BIOS of the computer assigns to each board that is in the PCI bus at start up. The PCI Bus Number and the PCI Device Number uniquely identify a slot in PCI bus, or in this case, a slot in a PXI chassis.
The PXISYS.INI file is an ASCII text file that combines information of the architecture of a controller and information of a chassis, and describes the physical location of installed peripheral modules. Device drivers and other utility software will read the PXISYS.INI file to determine information about the system. For more information about the PXI System Initialization File see Product Documentation: Configuring Your PXI System in Legacy Versions of MAX.
Note: If you do not have a PXISYS.INI file in your Windows directory, or you have the incorrect PXISYS.INI file for your combination of chassis/controller, then MAX will report slot numbers as either "0" or something erroneous. To install the appropriate PXISYS.INI file, please follow the directions in KnowledgeBase 2CFE965P: Slot Detection of PXI Modules.
Measurement & Automation Explorer (MAX) displays the National Instruments boards under "Devices and Interfaces". The driver of each board assigns a logical device number to every National Instruments board. This logical device number is the one LabVIEW uses to refer to the boards. MAX reads this logical device number and displays it, and also reads the PXISYS.INI file and extracts the information necessary to display the slot number on the PXI chassis where each board is connected. The logical device number that the driver assigns to each board does not always correspond to the slot number, and it can be changed manually by the user from MAX.
According to the PXI specifications, every PXI system controller module is supplied with VISA. However, not every driver of PXI boards must support VISA. If a PXI board' driver supports VISA and its PXI VISA Resource Name follows the same pattern than the one described in the next paragraph, Measurement & Automation Explore (MAX), National Instruments Configuration Software, will display all of the PXI VISA Resource Names. If you cannot see the VISA Resource Names, follow the instructions in KnowledgeBase 2CMCAHLS: How Can I View the PXI Visa Instrument Descriptors in MAX?
The VISA Resource Name will be in the form PXIx::y::INSTR. The first number, x, is the PCIBusNumber, and y is the PCIDeviceNumber of the specific PXI slot where the PXI card is located. The PCI Bus Number and PCI Device Number values in the PXI VISA Instrument Descriptor can be mapped with the information in the PXISYS.INI file, and the slot can be found. See more information in KnowledgeBase 2IJ896LS: What is the Format of VISA Resources for PXI Devices.
If the board uses the NI-DAQmx driver, the Device Number assigned to the board by the driver (the one that you see in MAX and use to refer to the board when calling any NI-DAQ API function) corresponds to the slot number in the PXI chassis. See more detailed information in KnowledgeBase 2E1AJUQI: Correlation of PXI DAQ Device Number to PXI Slot Number.
The controller of a PXI chassis is always installed in the first slot of a PXI chassis, so the device numbers that MAX can assign to the PXI boards go from "Device 2" to the maximum number of slots in the PXI chassis.
- Install the appropriate PXISYS.INI file in the Windows System Directory.
- After installing any new board in the system, launch the Measurement & Automation Explorer, go to the menu View, and select Refresh.
- You can use the "Get DAQ Device Information.vi", located in the palette Functions>>Data Acquisition>>Calibration and Configuration, to find out different characteristics of your PXI boards, such us device name, serial number, NI-DAQ version, among others. If there are not any boards in a slot or the board in a slot does not use the NI-DAQ driver, the VI will return error -10401 (the specified device is not a National Instruments product), because the driver cannot recognize this board.
- The relationship between the Slot Number and the Device Number is known, in this case, they are the same number.
- When using a MXI-3 interface to control the PXI chassis with a PC, you cannot have more than one PCI-DAQ, PCI-Motion or PCI-MI National Instruments board in the computer. This is because the drivers will assign "Device 1" to that one PCI board. If you had more than one of this boards, we cannot guarantee that the logical device number of the boards in the PXI chassis will match with the slot they are installed in. The second board in the PC might be assigned to "Device 2", and then the board installed in the second slot of the PXI chassis will have to use an available device number, for example "Device 64".
- The user can change the logical device number manually in MAX and brake the relationship between the Slot Number where the board is installed and the Device Number assigned to the board by the driver.
- This only works with National Instruments boards that use NI-DAQ (This includes DAQ boards and almost all MI boards). PXI-Switch boards do not use this driver.
- This method does not work for PXI-PCMCIA Carrier boards, PXI-Ethernet boards, PXI-GPIB boards and PXI-Serial boards.
- This method is not flexible because it depends on a specific driver. If there are any third party vendor boards, you will not be able to use this method to identify the slot where the boards are installed.
Use this method if you are using Windows 2000 or XP and do not have NI-DAQmx or NI-VISA.
The information for PXI devices can be found in under the following Windows registry key: HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\PCI. All NI PXI devices will begin with "VEN_1093....".