Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I find out what instruments are attached to the GPIB

just installed the .net classes. I then ran the example projects. A new device is created with
device = new Device(0,2,0)
This does not throw an exception even though there are no GPIB devices attached.

So my questions are
1. How can you tell if a particular device is attached, and
2. Is there any equivalent to the NI-288.2 multi-device calls


Thanks.


Chuck Gantz
0 Kudos
Message 1 of 5
(3,918 Views)
Hi Chuck,
if you want to confirm that a device is attached at a particular address, you can use the FindListener method on the Board class. This method takes an instance of the Address class and returns a bool indicating whether a listener is detected at that address, like this:

//test for primary address 2 on board 0
Board board = new Board(0);
Address address = new Address(2);
if (b.FindListener(address))
{
Device device = new device(0, address);
}
else
{
...
}

If you want to find the address of all available devices, you can use the FindListeners method, like this:

Board board = new Board(0);
AddressCollection addresses = board.FindListeners();
Device[] devices = new Device[](addresses.Count);
for (int i = 0; i < addresses
.Count; ++i)
{
devices[i] = new Device(0, addresses[i]);
}

I'm not sure what you mean by "multi-device calls." Can you elaborate a little more on what you'd like to be able to do?
0 Kudos
Message 2 of 5
(3,918 Views)
Hi Glenn,

Thanks for the reply. FindListener(s) is what I was looking for. I'm not sure why I didn't see it in the help when I looked, but I guess that's life.

I kept looking at the Device class since I thought that's where the instruments belonged. As far as "multi-device calls", that is what National Instrument calls their functions that allows you to address more than one device/board at a time. It looks like they have combined the single board/device calls with the multi-device calls by using overloading, which makes sence.

Chuck
0 Kudos
Message 3 of 5
(3,918 Views)
Chuck,
just so we're clear, w.r.t. multi-device calls, are you referring to the overloaded Write methods on the Board class that take an AddressCollection, and are those methods what you were looking for, or are there other multi-device operations you want to do and can't find a method for?
0 Kudos
Message 4 of 5
(3,918 Views)
Hi Glenn,

No, I'm not referring to the overloaded Write methods. If you look in the NI NI-488.2 Function Reference Manual, you will see that they divide the old (non-NET) GPIB function calls into Traditional calls (used to talk to one device or board at a time) and Multi-Device calls (used to talk to more than one device or board at a time). The Multi-Device calls are what I was asking about in my second question.

I now see that the Multi-Device functionality is in the board class, along with the traditional device call functionlity by using overloading.

Chuck
0 Kudos
Message 5 of 5
(3,918 Views)