Performing Analog Output Software-timed Waveform Generation in LabVIEW

Updated Jun 28, 2024

Environment

Hardware

  • Analog Output Device

Software

  • LabVIEW

Driver

  • NI-DAQmx

This article outlines the steps to perform software-timed waveform generation task using AO module or Multifunction I/O device in LabVIEW.
 

For demonstration purposes, this article creates a software-timed 5Hz sine wave generation task using USB-6363 in LabVIEW.

1. Launch LabVIEW and navigate to Help>>Find Examples.
2. On the NI Example Finder window, navigate to Hardware Input and Output>>DAQmx>>Analog Output>>Voltage – On Demand Output VI.

3. Open the VI.
4. Modify the block diagram of the VI, as shown in diagram below.
Software-timed waveform generation.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.

5. Double click the Simulate Signal Express vi. A window will pop up.
6. Configure the settings as below:
  • Signal type: Sine
  • Frequency (Hz): 5
  • Samples per second (Hz): 50
  • Number of samples: 1
  • Select Simulate acquisition timing
  • Note:
  1. To properly represent the signal's shape, the update rate used should be at least 10 times greater than the signal frequency.
  2. For software-timed generation task, only single sample can be outputted at a time.
  3. For software-timed generation task, the rate may be inaccurate due to the code's performance, Operating System and hardware setup. You are not recommended to use update rate greater than 500Hz.
image.png

7. Configure the channel settings such as channel name, maximum voltage and minimum voltage.
8. Run the VI.
 
 

The result can be verified by reading back the AO value in relation to AO GND by selecting the Internal Channel in NI MAX.
Note: Not all NI-DAQmx device can read back the AO value using internal channel. For more information, please refer to Reading the Value of Analog or Digital Output Channels in LabVIEW and LabWindows™/CVI.