Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an API that returns the model number or other identifier for an installed module, that I can use to identify that module's characteristics?

Solved!
Go to solution

For example, I am calling

DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.AI, PhysicalChannelAccess.External)

To obtain a list of connected devices.  The return array data looks something like this:

cDAQ1Mod4/ai0  (etc.)

This tells me that I have a CompactDAQ chassis, which is good, and an analog module in the Module4 slot.  What I need to know is not just that there is an analog module in the #4 slot, but also its capability (voltage, temperature, strain, etc.) so that I can use the correct DAQmx task for that module type.  All of this must be discovered at runtime. 

Otherwise, I will have to provide a configuration utility where the program user has to identify which module is plugged into which slot -- and if he changes this by moving it to another slot, he has to re-enter these details.  I want to avoid this by making the hardware as discoverable as possible.

I may have overlooked an API -- and that's my hope.

**bleep**

0 Kudos
Message 1 of 8
(5,045 Views)

Hi **bleep**,

 

The information that you want is found in the DAQmx C referance help file. To get there:

 

Start>> All programs>> National Instruments>> NI DAQ>> Text-Base Code Support>> DAQmx C referance help>> NI- DAQmx C Properties

 

There you will find device properties and channel properties. I hope that this helps.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 8
(5,036 Views)

Perry,

IMO, the DAQMx .NET library should expose this function. If that isn't possible, then an example of how to PInvoke it using C# or VB.NET.

At the end of the day, what I need is a list of the modules that are plugged into a chassis, by model number. For example, "NI9201" or equivalent. That way, I can make sure that I am using the correct DAQMx task, since I have a separate one for each basic module category (analog input, thermocouple input, RTD input, etc.).

For this purpose, the return from DaqSystem.Local.GetPhysicalChannels or DaqSystem.Local.Devices doesn't do the job. If I have to PInvoke some low-level method, I need help with the syntax.

**bleep**

0 Kudos
Message 4 of 8
(5,029 Views)
Solution
Accepted by topic author Dick Grier

Hi,

 

I was able figure out the syntax for you. Here it is.

 

Device blah = DaqSystem.Local.LoadDevice("cDAQ1");
            foreach (String dev in blah.ChassisModuleDeviceNames)
            {
                label1.Text += "\n" + DaqSystem.Local.LoadDevice(dev).ProductType;
            }

 

This prints out the model number of all of the cDAQ modules in the chassi. I hope that this helps.

 

Regards,

 

Perry S.

Applications Engineer
National Instruments
Message 5 of 8
(5,016 Views)

Hi,

 

NI-DAQmx 9.3 added some new properties to return the AI supported measurement types for a specific device or channel:

 

NationalInstruments.DAQmx.Device.AISupportedMeasurementTypes

NationalInstruments.DAQmx.PhysicalChannel.AISupportedMeasurementTypes

 

For example, this Powershell code:

 

[System.Reflection.Assembly]::LoadWithPartialName("NationalInstruments.DAQmx")

[NationalInstruments.DAQmx.DaqSystem]::Local.LoadDevice("Dev1").AISupportedMeasurementTypes

 

has the following output with an NI 6259 installed as Dev1:

 

Current
Resistance
StrainGage
Rtd
Thermistor
Thermocouple
BuiltInTemperatureSensor
Voltage
VoltageCustomWithExcitation

 

Brad

---
Brad Keryan
NI R&D
0 Kudos
Message 6 of 8
(5,004 Views)

Hi Perry,

I am not familiar with C programming.  Is there a way of achieving graphically what you have described below?

 

Chundra

=======

0 Kudos
Message 7 of 8
(4,340 Views)

Hello,

 

You can programmaticaly find DAQmx Device names within LabVIEW.

 

Check out the example below:

 

Programmatically Determine what cDAQ Modules are in a Chassis

https://decibel.ni.com/content/blogs/labview-examples/2011/05/08/programmatically-determine-what-cda...

Matt G.
Product Manager
National Instruments
0 Kudos
Message 8 of 8
(4,330 Views)