From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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

Save NI-DAQmx Tasks, Channels, and Scales within LabVIEW

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

The following examples illustrate how to programmatically save NI-DAQmx Tasks, Channels, and Scales. This allows the creation of an application which can be deployed to an end user and when ran, it will configure their system with the tasks, channels, and scales defined.

Description

The following example VIs perform the following functions:

  1. Create and Save Task - Programmatically creates and saves an NI-DAQmx task.
  2. Create and Save Global Channel - Programmatically creates and saves an NI-DAQmx Global Virtual Channel.
  3. Create and Save Scale - Programmatically creates and saves an NI-DAQmx linear scale.
  4. Create and Save Task, Channel, and Scale - This is the most complicated of the four examples, so it is encouraged that the user understand the first three examples before running this example. This example creates and saves a linear scale. Then a DAQmx Global Virtual Channel is created which references the linear scale. The Global Virtual Channel is then saved. Finally, a DAQmx Task is created which references the DAQmx Global Virtual Channel which was just saved. The Task is then saved. So in the end the user has a Task which references a Global Virtual Channel which references a Scale.

Requirements

Software

  • LabVIEW 2010 or compatible
  • DAQmx 9.1.5 or compatible

Hardware

  • NI Multifunction DAQ Card


Steps to Implement or Execute Code

  1. Download and open the LLB
  2. Select which example you would like to use within the LLB
  3. Configure all of the controls on the front panel of the example you selected
  4. Run the example VI
  5. Repeat steps 2-4 until finished


Additional Information or References


Create and Save Task Block Diagram

Create and Save Task.png

Create and Save Global Channel Block Diagram

Create and Save Global Channel.png

Create and Save Scale Block Diagram

Create and Save Scale.png

Create and Save Tasks Channel and Scale Block Diagram

Create and Save Task, Channel, & Scale.png

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

Regards,
Dan King

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

Comments
Confuzed
Member
Member
on

Thanks for these examples.  Can you add a further example that shows how to create/save a task that has multiple channels?  For example, how to create a task that contains an array of thermocouples on 9211 cards in a cDAQ chassis?  Really, an example that shows how to programmatically create/save a task with multiple channels, any channels, would be helpful.

Contributors