From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Determine DAQmx Device Name when Deploying Executables

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Data Acquisition (DAQ)

    Software

  • LabVIEW

    Driver

  • NI DAQmx

Code and Documents

Attachment

Overview

This example uses a DAQ System Property node to return an array containing the DAQmx resource names of all of the hardware on the computer.

 

Description

When preparing a program to be built into an executable meant for deployment, it may be advantageous to include code that will detect all devices on the deploymnet machine, determine which one is the correct device, and then output it's DAQmx resource name for use within the exectable. This will cut down on confusion for any operators who may be running the executable and unfamiliar with LabVIEW or the DAQmx device resource naming paradigm. 

The example program downloadable here uses a DAQ System Property node to return an array containing the DAQmx resource names of all of the hardware on the computer. It then uses a for loop to interate through each resource name, obtaining the Product Type and Serial number of that specific device. These can be compared to the desired value for the device that was deployed with the code. When a match is found, the for loop is exited and the DAQmx Device name is output for use in the acquisition code.

 

Requirements

Software

  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible

Hardware

  • NI Multifunction DAQ Device

 

Steps to Implement or Execute Code

 1. Enter the Product Type of the device you want to acquire from, ex USB-6009 or PXI-4472

2. Enter the channels of the device you want to acquire from, beginning with a "/", ex "/ai0:3" to acquire from analog input channels 0, 1, 2, and 3.

3. Configure the Maximum and Minimum expected values of the acquisition, as well as the desired Timing Properties.

4. Run the VI. It will now search the system for the matching product and acquire on the configured channel

 

Additional Information or References

 

 

 

 

Identy BD.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

Mallori M
National Instruments
Sr Group Manager, Education Services

ni.com/training

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.