Example Code

Dynamically Adjust Frequency and Amplitude for a Generated Sine Wave Using NI-DAQmx for LabVIEW NXG

Code and Documents

Attachment

Overview

This VI generates a sine wave for which the frequency and amplitude can be dynamically modified using NI-DAQmx with support for LabVIEW NXG.

Description

By updating the frequency and amplitude controls within the While loop, they can be modified while the VI is running. In order to create a smooth transition from one frequency to another or one amplitude to another, an incomplete sine wave must be modified with an appended section so that the resulting wave after each iteration of the while loop ends at the x-axis. 

Hardware and Software Requirements

  • LabVIEW NXG 1.0 or compatible
  • DAQmx 17.0 or compatible
  • Physical or Simulated Analog Output Device supported by DAQmx

 

Steps to Implement or Execute Code

Steps to Implement or Execute Code:

1. Select a Physical Output Channel from an Analog Output device.
2. Run the VI.
3. Change frequency and amplitude as desired.
4. Click Stop to stop the VI.

Additional Information or References

Ashley G.
Senior Applications Engineer | RF & Wireless Communications

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

Contributors