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.


  • Data Acquisition (DAQ)


  • LabVIEW


  • NI DAQmx

Code and Documents



This application demonstrates a method for generating multiple analog waveforms output on multiple channels.



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. 



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



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.


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?


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!