Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using MAX to create VISA Names programmatically?

I am writing a program to communicate with some number of GPIB devices. Different tests use different numbers of devices. I have two NI GPIB-USB HS’s in the system. Sometimes the user will have 8 devices on each USB-GPIB (Agilent 34970A). Sometimes 7 on “0” and 1 on “1”, sometimes 8 devices on each, sometimes they only connect two or three devices.

For example:

Test “A” uses 8 devices defined as GPIB0::1::INSTR, through GPIB0::8::INSTR

Test “B” uses 8 devices defined as GPIB0::1::INSTR, through GPIB0::7::INSTR, and GPIB1::8::INSTR

Test “C” uses 16 devices defined as GPIB0::1::INSTR, through GPIB0::8::INSTR, and GPIB1::9::INSTR through GPIB1::16::INSTR

Test “D” some random combination of devices.

 

My problem as the programmer is to query the devices attached to the computer, use that information to create the VISA resource names, and compare that to the (user generated) config file that defines what test to run. My program needs to make sure that the proper hardware is attached, On and initializes properly. I need to do this programatically so it is invisable to the end user. This will be distributed .exe code that will used on dozens of test stations.

 

My actual question is…

How do I query the GPIB resources connected to my PC and us that information to create my VISA Resource Names? Do I use MAX or is there another way?

I would also like to know how to do this for other stuff. I often load an .exe on other computers that have the DAQmx card in a different slot or already has a PCI card in it  so, for example,  my Device 1 is now Device 2 and I have to create a new .exe.

 

I’m sure there must be tutorials on this somewhere but I couldn’t figure out what to search for.

 

Thanks,

Ross

0 Kudos
Message 1 of 3
(4,111 Views)

You may want to check out the NI System Configuration API.  You can use it to enumerate all of the NI-VISA devices and use the rename functionality to set the Alias.

 

http://www.ni.com/download/ni-system-configuration-5.6/4517/en/

 

I would start with the Find Hardware shipping example to get an idea of how to use it.

0 Kudos
Message 2 of 3
(4,102 Views)

Thank-you, I am going through your link right now.

0 Kudos
Message 3 of 3
(4,097 Views)