Example Code

Continuous Generation of a Voltage Waveform with an Initial Ramp Up

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 demonstrates how to output a sine waveform.

 

Description:

This example VI will output a ramping up sine wave followed by a steady state sine wave. This method allows for a nearly seamless transition from the ramp state to steady state.

 

Requirement:

NI LabVIEW 2012 or compatible

NI-DAQmx 9.0 or compatible

 

Steps to Implement or Execute Code:

Steps to Complete:

  1. Create an Analog Output Voltage channel.
  2. Configure the task to prohibit the automatic regeneration of data.
  3. Call the DAQmx (Sample Clock) VI to set the sample clock rate. Additionally, set the sample mode to Continuous.
  4. Read the actual sample clock rate.
  5. 5a. True Case: Compute the desired waveform for the ramp up. We use a Formula Waveform.vi which allows the user to input an equation. This is only needed when the loop is executed for the first time.
    5b. False Case: Use the Basic Function Generator.vi to create a steady state sine wave.
  6. Write the waveform to the output buffer.
  7. 7a. Call the Start VI. This is only needed when the loop is executed for the first time.
    7b. Do nothing.
  8. Loop continuously until user presses the Stop button. Every iteration computes and writes a new waveform to the buffer.
  9. Call the Clear Task VI to clear the Task.
  10. Use the popup dialog box to display an error or warning if any.

 

2017-04-26_15-00-43.jpg

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Applications Engineer
National Instruments

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

Comments
jwdz
Active Participant
Active Participant
on

To LabVIEW2009?

" 一天到晚游泳的鱼"

labview@263.net

我的个人网站:LabVIEW——北方客栈 http://www.labview365.com
欢迎加入《LabVIEW编程思想》组——http://decibel.ni.com/content/groups/thinking-in-labview