From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Get a list of GPIB board/interfaces.

Solved!
Go to solution

I would like to know how to get a list of GPIB board/interfaces that are connected to a computer using the NI4882 library in VB.NET.

 

Thanks,

-Garth

0 Kudos
Message 1 of 5
(3,647 Views)
Solution
Accepted by gls

Hi Garth,

 

There are a couple of options for you to retrieve the list of GPIB Devices. The one that I would suggest is to use the VISA API instead of the 488.2 API to achieve this. In the VISA API, there is a method called "Find" in the CNiVisaResourceList Class. It returns a list of names of resources in the VISA system. It also takes in inputs where you can use a regular expression to specify exactly which interface you want to search.

Raj
National Instruments
Applications Engineer
Message 2 of 5
(3,591 Views)

Raj,

 

Thanks for the reply.  I think I found the method you recommended but I couldn't find information on the expression that is used in the FindResources function.  I did find an example but it returns instruments as well as the board/device which I don't need.  I would just like the board/device returned.  Is there an expression that does this?  May seem trivial but if I have twenty instruments hooked to one board/device I don't want twenty items returned, I just want one.

 

A sample of my code is below:

 

 

Dim vs As NationalInstruments.VisaNS.ResourceManager
Dim resources() As String

vs = NationalInstruments.VisaNS.ResourceManager.GetLocalManager
resources = vs.FindResources("GPIB?*INSTR")

 

 

0 Kudos
Message 3 of 5
(3,579 Views)

Raj,

 

Playing around with the expression I found the correct one.  Thanks for your help!

 

-Garth

0 Kudos
Message 4 of 5
(3,574 Views)

I know this thread is quite old but do you have an example of what could be used in VB or VBA for how to find all instruments on a GPIB? And what references would have to be added for it to work?

0 Kudos
Message 5 of 5
(1,143 Views)