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

Multiple Channel Analog Output with Dynamically Updated Waveform Attributes

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 application demonstrates a method for generating multiple analog waveforms output on multiple channels.

 

Description

This example is scalable to any number of available channels available on the system and It also integrates a method for dynamically varying the output waveform attributes. All parameters including the waveform type, may be updated at run-time. 

 

Requirement

LabVIEW 8.2  (or compatible)
NI-DAQmx 8.9  (or compatible)

 

Steps to Complete

  1. Configure the Physical Channels in the Task, define the Output Maximum and Minimum Values for the waveforms.
  2. Deploy a DAQmx Property Node to identify the number channels in the task.
  3. Employ a For Loop with the Basic Function Generator to define the intial output waveforms. This function will produce a waveform for each channel in the task.
  4. Use the DAQmx Write to upload the waveforms to the hardware buffer.
  5. Deploy a user even structure to monitor for value changes on the waveform attribute variables. The system will only redefine the output buffer if a channel parameter has changed.
  6. Using Local Variables, we may extract updated values within the loop structure for updating waveform information.
  7. Calling a DAQmx Write on Value Change will update the hardware buffer with the new waveform information.
  8. After the loop is completed, clear the DAQmx Task Definition.

 scfp 10821.jpg

snippet.png

 

Additional Notes

For additional information on the functions used in this example, please use Crtl+h to access the LabVIEW Context Help.

 

Patrick Corcoran
Application Engineering Specialist | Control
National Instruments

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

Comments
Zach_Phys_Research
Member
Member
on

Would this application be able to utilize the analog outputs of the NI cDAQ-9171 as analog output channels for waveform generation, or would this need something more like the NI USB-6343?

partial81
Member
Member
on

Very useful program which helped me a lot to solve my programming problems with the DAQmx Write and updating the waveform properties!
Thanks a lot for sharing it with others!