Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Function Generator with Analog Output

Overview

These example programs are a modification of LabVIEW DAQmx shipping example Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi that shipped with LabVIEW 2011 and earlier. They are modified so that the user and start and stop the output on demand. The documentation of the Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi still apply and is quoted below:

Description

This example demonstrates how to continuously output a waveform using an internal sample clock. The automatic regeneration of data has been disabled, so new data has to be provided throughout the duration of the continuous Analog Output operation. This allows the generation of any arbitrary frequency as this VI computes new data for each iteration of the loop, maintaining phase continuity of the signal.

Requirements

Software

  • LabVIEW 8.6 or compatible
  • DAQmx 8.7.2 or compatible

Hardware

  • NI DAQ device with Analog Output

Steps to Implement or Execute Code

1. Select the Physical Channel to correspond to where your signal is output on the DAQ device.
2. Enter the Minimum and Maximum Voltage range.
3. Specify the desired Sample Clock Rate of the output Waveform. Higher sample clock rates will produce a smoother waveform.
4. Manually specify the Analog Output buffer size, in number of samples. A larger buffer would help non-regenerative operations avoid errors due to occasional high CPU load.
Note: The Analog Output buffer has to be at least as big as the amount of data being written to the board per iteration. The recommended buffer size would be at least twice the amount of data being written to the board per iteration.
5. Enter the Waveform Information.  See the documentation of the Basic Function Generator SubVI for information on each parameter

The function generator 2 channel.vi is designed for using two analog outputs and the function generator 4 channel.vi is designed for using four analog outputs. Using the Basic Function Generator VI you can generate a waveform that can be outputted on an along output.

Screenshot of function generator 2 channel.vi block diagram.

function generator 2 channel block diagram.JPG

Screenshot of function generator 4 channel.vi block diagram.

function generator 4 channel block diagram.JPG

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

Comments
Todd S.
NI Employee

Thanks for posting!  Could you please include a screen shot of the code to give a better idea of what it looks like and also rename your attachments to include the LabVIEW version?  "_lvXX.vi" would be good enough.

Todd S.
LabVIEW Community Manager
National Instruments
Member papacode
Member

In four channel mode why cant I use the full sample rate of my DAQ (PCIe-6363-2M).  I get an error if i put anything over about 1.8M. 

Error - 200018

Member buckonthenet
Member

Hi Papacode,

Error code -200018 can have multiple causes, and so I highly encourage you to work with an NI Application Engineer. Can you please work with one of our Applications Engineers or post at forums.ni.com? If you go to ni.com/contact you can select "Request Support" and be given multiple options to get technical help.

Please understand I no longer work with the DAQ devices or in technical support. If you have tried to contact NI AEs and haven't received a response within 48 hours please post back here and I will do my best to help.

Member guto26
Member

there is error the number of data does not match the number of channels how do i fix it thanks a lot guy 

Contributors