Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ hardware list

Hi,
 
I am doing a DAQ application in VS.Net 2005 and MS 8.0. In my application, we are using more than one DAQ Cards. Now I would like to get DAQ card list when I start my application, The hardware information should include card name (dev1, dev2...), Model Name, Usb/PCi or some other interfaces, how many ai channels for each card, and so on.  Actually, I know in daqsystem.local will list some information, but they are not convenient to list all information above that I need. Is it any other ways to do that? Thank you very much!
 
 
0 Kudos
Message 1 of 4
(3,200 Views)
Hi Yhong,
 
It's actually possible to get a variety of information about each device in your system programmatically via the DAQmx for .NET library that we provide, including the information you asked about.  It's actually pretty easy.  Here's some code to help get you started:
            
string s = "Dev1"; // Or whatever your device name is
try
{
    Device d = DaqSystem.Local.LoadDevice(s);
    MessageBox.Show("Device Name: " + s);
    MessageBox.Show("Model Name: " + d.ProductNumber);
    MessageBox.Show("Product Category: " + d.ProductCategory);
    MessageBox.Show("Interface:" + d.BusType);
    MessageBox.Show("AI Channels: " + d.AIPhysicalChannels.Length);
}
catch (DaqException ex)
{
    MessageBox.Show(ex.ToString());
}
If you have any further questions, don't hesitate to ask.
Hexar Anderson
Measurement Studio Staff Software Engineer
National Instruments
0 Kudos
Message 2 of 4
(3,190 Views)
hi:
 
Thank you for your explaination, however, I still have another question. How do I know how many DAQ card are connected to the PC and what is their device name. Actually, when a new DAQ is installed, the device name is starting "dev1", "dev2".... , right? Thank you very much!
 
yang
0 Kudos
Message 3 of 4
(3,191 Views)

To get the list of device names on your system, you need to use the DaqSystem.Local.Devices property.  For example:

foreach (String s in DaqSystem.Local.Devices)
{
    MessageBox.Show(s);
}

To get the number of devices, you can also use the Devices property:

MessageBox.Show(DaqSystem.Local.Devices.Length.ToString());

Hexar Anderson
Measurement Studio Staff Software Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,164 Views)