This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Programmatically Finding Device Name of DAQ Device in System in LabVIEW

Updated Jan 11, 2019

Reported In

Software

  • LabVIEW

Driver

  • NI-DAQmx

Other

Multifunction DAQ

Issue Details

I am using low level DAQmx VIs, specifically Create Channel VI, which requires a physical channel input.  When I run my executable with a new device that is the same model (e.g., two different USB-6210s), my code breaks because Measurement & Automation Explorer (MAX) names the second device as Dev2 and the original device as Dev1.

How can I programmatically find the name given to the new device in MAX, so that my code does not break when I use a new device of the same model?

Solution

A DAQmx System property node can be used to find the list of device names.  A DAQmx Device property node can be used to determine the product type, which can be matched against a string containing the desired device model name.  A conditional for loop is used to iterate through all the device names in the system and stops when the first device name match is found.  When the loop stops, the device name is passed out of the loop and the channel is appended to the end of the string.  The resulting string can be used as the physical channel input for Create Channel VI.


Another approach that is useful if multiple devices of the same model are installed, is to use a conditional indexing tunnel on the for loop. This is shown in the second snippet and will return an array of all matching devices.
 

 

Additional Information

These snippets will only only work with NI DAQmx devices. If you need to find other devices you should consider using the NI System Configuration API.

If you are distinguishing between more than one of the same device, you can use a hardware property node to compare the device's serial number to select the correct device. If only one device is present but several are listed in NI MAX, you can use the "Is Present" method from a hardware property node or error validation.

WAS THIS ARTICLE HELPFUL?

Not Helpful