From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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

Two Analog Output Waveforms With Different Frequencies and/or Different Waveform Types

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 gives one simple option for generating similar or dissimilar waveforms at the same frequency or different frequencies from each other.

Description

Sometimes it is useful to output two different waveforms at different frequencies. This can either mean two waveforms of the same waveform type at two different frequencies or two dissimilar waveform types at the same frequency.  There is one caveat with this example: it was made with a fixed Sample Clock Rate of 100kHz. The frequency that you input is the desired output frequency of the signal. This means that the desired frequency you input must be an integer divide down of 100,000.


In later versions of LabVIEW and the NI-DAQmx driver, this functionality was included in shipped examples. To find these examples, go to Help » Find Examples » Hardware Input and Output » DAQmx » Analog Output. 

Requirements to Run

Software

LabVIEW version 8.2 or compatible

DAQmx 8.3 or compatible

Hardware

NI Multifunction DAQ device with at least two analog output channels compatible with NI-DAQmx

Steps to Implement or Execute Code

  1. Download the example for the version of LabVIEW you have installed
  2. Configure the following on the front panel:
    • Physical Channel of your DAQ device
    • Maximum and Minimum Value for the amplitude of your signal
    • Signal 1 and 2 types
    • Waveform 1 and 2 Desired Frequency
  3. Run the VI
  4. Observe the Output Waveform on the front panel of the VI

Additional Information or References


Front Panel

2 Waveform Gen.JPG

Block Diagram

2 Waveform Gen BD.JPG

**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.

Comments
Todd S.
NI Employee (retired)
on

Thanks for posting!  Could you please include a screenshot or two of the VI to give us an idea of what the code might look like?  Also, please rename your one attachment to include the LabVIEW version.

Todd S.
LabVIEW Community Manager
National Instruments
John_P1
Trusted Enthusiast
Trusted Enthusiast
on

Anybody interested in doing this might also want to check out the following related example:

Generate Multiple Channels of Analog Output with Different Frequencies

It should be more scalable if you need to use more than 2 channels and has some other benefits described on the page.

John Passiak
Contributors