10-22-2010 01:18 PM
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
Solved! Go to Solution.
10-26-2010 08:03 AM
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.
10-26-2010 11:46 AM
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")
10-26-2010 12:10 PM
Raj,
Playing around with the expression I found the correct one. Thanks for your help!
-Garth
06-15-2022 04:22 PM
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?