Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use addressList in Measurement Studio.NET


How do I create an addressList that can be used with the FindListeners() or Trigger() methods of a board object?
 
Language: C#
NI product: Measurement Studio.NET 8
Hardware: GPIB
 
I want to create an addressList that I can use in the FindListeners(0 and Trigger() board methods.  However, the Measurement Studio doesn’t tell you anything except that an addressList is somehow an AddressCollection type.
 
Can someone explain what an <b>addressList</b> is, how to create one, and how to use it?
 
I have used board.FindListeners() without an addressList parameter, and it returns a list of all listeners on the GPIB that respond:
 
public AddressCollection addresses;
addresses = board.FindListeners();
//then…
public Device [] devices;
for(int i-0; i<addresses.Count; i++)
{
devices[i] = new Device(0, addresses[i]);
}
 
  So far, OK.  I have an array of devices, where each element contains a PAD (and a SAD if any).
 
But now I want to create sub-lists.  For example, I’d like to create a list of only HP34401A DMMs so that I can trigger only the DMMs simultaneously.  I know the PADs (no SADs used) of the DMMs from FindListeners() or from the instruments’ front panels.  But how do I actually create an addressList?
 
I would really appreciate an example of creating an addressList, then of using it in a Trigger() method.
0 Kudos
Message 1 of 2
(3,055 Views)
Hello Tony,
I believe what you're asking about is the "AddressCollection" class, which is used to represent a group of related GPIB addresses. You can create an AddressCollection like this:
//Create the collection
AddressCollection myAddresses = new AddressCollection();
 
//Add an address to the collection
myAddresses.Add(new Address(PAD, SAD));
 
//Note that you don't have to provide a SAD, it defaults to zero.
myAddresses.Add(new Address(JustPad));
 
//Make a call that uses the addressCollection
myBoard.Trigger(myAddresses);
 
Note that AddressCollection implements typical semantics for a .NET variable size collection, so you can add and remove elements from the collection as needed, index in to it, enumerate over it using foreach, etc. Each Address instance in the collection represents a particular gpib address on which you want to operate. You can create as many different AddressCollection instances, with different combinations of addresses, as you need for your application.
 
I hope the brief example code above does addresses (no pun intended) your need. Please let me know if you need further assistance.
 
Glenn Burnside
 
0 Kudos
Message 2 of 2
(3,044 Views)