Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I find the BdIndx (for use in ibdev) for a named board (e.g. 'GPIB0')?

I have several NI GPIB-ENET/100 devices in equipment racks each acting as 'Hubs' for one or more GPIB-controlled instruments.

Each of these Hubs is configured in NiMax under the usual naming scheme, 'GPIB0', 'GPIB1', 'GPIB2', etc.

From this I assume that their Board Index numbers are correspondingly 0, 1, 2 etc. But of course, the names can be changed.

 

The instruments are not named and identified in NiMax; they each just have a GPIB address pre-set in their config, or with DIP switches, or whatever they have.

 

Now in the this support article, it is suggested I use ibfind to connect to one of these hubs (a 'board') by name, but to connect to one of my instruments (a 'device') I should use ibdev.

http://digital.ni.com/public.nsf/allkb/20111CA8C1BB0E6D86256F2E0064FEE0

 

My problem is, I know the name of my hub/board so can use ibfind. But my instruments aren't named. I want to go via the named hub/board using the GPIB address configured on each instrument. To do that I have to call ibdev and pass the index number of the hub/board. And I don't really know for sure what that is - I can only guess from the way the names 'GPIB0', 'GPIB1' etc. were automatically assigned in that order.

 

Is there any way to identify the Board Index (BdIndx) for use in the ibdev call for a board that is only known by name, e.g. 'GPIB2'?

0 Kudos
Message 1 of 7
(5,429 Views)

Hello JJ,

 

Based on what you've described, could you upload a MAX report for me to have a look at? That would allow me to better understand the exact setup you have and the issue you're experiencing and allow me to see what you can see in MAX. If you aren't familiar with MAX reports then you can see instructions on creating one here:  http://digital.ni.com/public.nsf/allkb/271F252B4EF0A2E0862570E70056A1E4

 

Best regards,

Jake

Jake A

Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 7
(5,371 Views)

HI Jake - thanks for taking the time to help.

 

I'm afraid I don't have a fully populated system to try anything at the moment - we build them to order then they get tested and shipped out without much warning! The software we have works, but it was written some time ago and I'm worried it's not going to hold up for some more complicated systems we're planning.

 

Perhaps I can better explain my problem with a simple example. I'm using the NI-488.2 C API in my code.

When working, I have one or more GPIB-ENET/1000 devices on my local network and registered in NI-MAX, where they're (automatically) named 'GPIB0', 'GPIB1' etc. Each has one or more measurement instruments attached by GPIB cables.

 

Now to connect to one of the measurement instruments, the description of the command ibdev says:

 int ibdev (int BdIndx, int pad, int sad, int tmo, int eot, int eos)

 

And defines BdIndex as:

  BdIndx : Index of the access interface for the device

 

 

So, first off, how do I know (for sure) what value of BdIndex to use? What does it signify?

 

Does it relate to those GPIB-ENET/1000 devices, and if so, how does it relate to the names they've been given, 'GPIB0', 'GPIB1' etc?

 

 

Jason Railton

Software Engineer

Ultra / EW Simulation Technology

0 Kudos
Message 3 of 7
(5,366 Views)

Hi Jason,

 

 

Ah I see, thanks for explaining the overall application. I've had a look to see what values to use and I haven't really been able to find much. I did find a case where it was suggested to use the values Dev1, Dev2, Dev3.... for each, but I also found a document which suggested that these indexes would simply be values starting at 0 and ascending in order, much like how the GPIB/ENET devices are named GPIB0, GPIB1, etc. My best suggestion at this time would be to try both of these identifiers and see if either work, and if neither does then post back here so I can help you further.

 

Best regards,

Jake A

Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 4 of 7
(5,356 Views)

Hi Jason,

 

I found a community example for multiple devices written in C, and a KB whish may also prove relevant, so I thought I'd post the links  in case you find any useful information within them.

 

http://www.ni.com/example/27134/en/

 

http://digital.ni.com/public.nsf/allkb/9D60B240CEBC4BD2862574C8004AFE7A

 

Best regards,

Jake A

Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 5 of 7
(5,332 Views)

Well, our software already works based on the assumption that we've registered the ENET/1000 interfaces in a specific order (and not mixed in any other devices or edited the default names), such that the index numbers and the 'GPIBx' names align. That much works. Either contacting all the interfaces from 0 to N by forming the name 'GPIB'+n, or, given a specific interface name, read the numeric off the end and use that as the index.

 

I was just hoping I'd missed something in the API and that there was a hidden but definitive way to relate the interface names to their index numbers.

 

[EDIT] - Sorry, just saw you posted again. Will review what you've just posted up..

0 Kudos
Message 6 of 7
(5,330 Views)

OK, thanks for looking for me. I have had a look at that code and the GPIB names and the board indices are clearly hard-coded as separate things.

The names are specified as "GPIB0" and "GPIB1" that then end up in the call to ibfind(...), and the indices are specified as 0 and 1, the first parameter that ends up in the calls to ibdev(...).

 

   Initialize_GPIBENET_Controller("GPIB0", 0);
   Initialize_GPIBENET_Controller("GPIB1", 0);

   // These two instruments will be controlled by GPIB0 (ENET #1 in Fig. 4).
   mmeter = Open_Device (0, 2, 0, 13, 1, 0);
   scope = Open_Device (0, 21, 0, 13, 1, 0);

   // These two instruments will be controlled by GPIB1 (ENET #2 in Fig. 4).
   funcgen = Open_Device (1, 5, 0, 13, 1, 0);
   analyzer = Open_Device (1, 2, 0, 13, 1, 0);

 

Now my code reads the GPIB names for the devices it's going to work with from a config file and guesses what the index number will be. It's about to get a bit more complicated as we're moving things onto a wider network solution where the interfaces (and instruments) can be re-allocated daily. As I say, I was hoping I'd missed something in the API and that there was a hidden but definitive way to relate the interface name to the index number.

 

I guess the only definitive way is to have my config file define both the interface name and the index number. Either that or just carry on assuming that the name 'GPIB0' is index 0, 'GPIB1' is index 1, etc. and write strict instructions to ensure they're set up the same way in NI-MAX on all machines that have access.

0 Kudos
Message 7 of 7
(5,326 Views)