Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI resource string for acquireBoard

What is the best way to determine the PXI resource string to pass to acquireBoard(..)?  I have a PXI chassis with 6 identical NI6229 cards installed in it, and I need to make sure that I acquire the correct board.  Obviously I know which slot I've installed the cards in, so it's my preference to key off of that.

 

In reality it looks like my cards are all on bus 16, and my first card (installed in slot #2) is socket #15, so the correct PXI resource string is PXI16::15::INSTR.  The next card (slot #3) is socket #14.  So obviously I can empirically determine this, but I'm hoping to find a failsafe mechanism to do this programmatically -- some way to look up the socket number based on the slot in the chassis.

 

I've seen in the C:\Windows\pxisys.ini file there seems to be a lookup -- in the section [Slot2] it indicates the bus and device numbers.  Is the best way just to check this file?  Or is there a better mechanism?  And what if I had multiple PXI chasses connected to my computer?

 

Thanks,
AJ

 

 

0 Kudos
Message 1 of 8
(8,266 Views)

Hi AJ-

 

It sounds like you're using a Windows system.  Is there a reason you can't use NI-DAQmx?

 

In any event, assuming you're on Windows you could use the NI-VISA API to extract information about the PXI resource in use.  For example, you could get the slot path and find a way to correlate that back to the physical location of the board.  NI-VISA will also give you the device, function, and bus number if you prefer that method.  See the NI-VISA help for more info.

 

Alternatively, if you know something about the devices in use (for example, which device serial number resides in which slot), you could use the serialNumber.cpp example from the M Series MHDDK.

 

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 2 of 8
(8,264 Views)

Hey Tom,

I am writing an RTX driver, so yes it is on Windows, but at least within the RTX driver I can't use NIDAQmx.  Is the slot number or serial number stored in some register that I could check?  If so I could iterate through all of the cards until I find the correct one. 

 

Thanks,

AJ

0 Kudos
Message 3 of 8
(8,261 Views)

Duh, obviously the serial number is stored somewhere (just check serialnumber.cpp as you suggest!).  But is the slot number stored anywhere?

 

Thanks,

AJ

 

 

0 Kudos
Message 4 of 8
(8,260 Views)

Hi AJ-

 

You can query the slot number using NI-VISA.  Check out the attribute called VI_ATTR_SLOT in the NI-VISA help for more info.  You'll probably want to start with a basic NI-VISA example for PXI (see startmenu>>National Instruments>>NI-VISA>>Examples and check the General folder for FindRsrc.c) and then make a call to viGetAttribute() to retrieve the slot location for a specified instrument.

Tom W
National Instruments
0 Kudos
Message 5 of 8
(8,258 Views)

I meant is there a way that I can determine the slot number from my RTX process at a register level?  Or are you saying I can make calls like viGetAttribute() from within the RTX environment?

 

Alternatively, do the VISA calls simply use the pxisys.ini file to determine the slot numbers?  If so then I supposed I can just parse that file to find the information that I need.

 

Thanks,

AJ

0 Kudos
Message 6 of 8
(8,254 Views)

Hi AJ-

 

No, the PXI device doesn't really know which slot it is in so there's not much you could do from the register level.  I am proposing that you make calls using NI-VISA to viGetAttribute() (it's an NI-VISA function) to build up a map between PXI aliases and slot numbers during the initialization of your app.  I don't know if using the pxisys.ini file will always work or if it is easily done, but NI-VISA provides the functionality you seem to be looking for directly so I would encourage you to use that.

Tom W
National Instruments
0 Kudos
Message 7 of 8
(8,252 Views)

Ok, I think that's what I needed to know -- I'll go with that.

Thanks,

AJ

0 Kudos
Message 8 of 8
(8,250 Views)