Example Code

Dynamically Change the Lines in a DAQmx Analog Input Task Using an Event Structure

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 illustrates how to dynamically change the physically lines being sampled in a DAQmx Analog Input task thru the use of an Event Structure.

Description:

This example uses the 'physical channels' control to trigger an event on a Value Change. When this event is triggered, the current task is cleared and a new task is created with the new value of 'physical channels'. In this event, the waveform chart's history is also cleared. The built-in Timeout event is used to perform the actual DAQmx Read at an interval of 10ms.

Requirements:

Software:

  • LabVIEW 8.2 or compatible
  • NI DAQmx 8.3 or compatible

Hardware:

  • Most compatible DAQmx devices

Steps to Implement or Execute Code:

1.) Open the VI.

2.) Specify the line(s) you wish to sample.

3.) Run!

4.) Choose the line(s) you wish to sample and watch the waveform chart change accordingly!!!

Additional Information or References:

This example is currently written for a DAQmx Analog Input task, however, this can probably be expanded upon for other measurement types.

programmatically_change_lines_LV2009.png

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

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

Contributors