NI DAQmx: Continuously Generate Waveform - Non Regeneration - Rapidly Updating

Publish Date: Nov 09, 2013 | 1 Ratings | 5.00 out of 5 | Print | 1 Customer Review | Submit your review

I. 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. The regeneration of data has also been adjusted so that the newest data is output as quickly as possible; thus reducing the lag between the changing of the data and the output of that data.

II. Instructions for Running:
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.
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.

III. Block Diagram Steps:
1. Create an Analog Output Voltage channel.
2. Configure the task to prohibit the automatic regeneration of data.
2a. Set the transfer condition to Less than Full. Allows for more rapid updates of Output Buffer.
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 (eventually coerced depending on the hardware used).
5. Compute the desired waveform, using the buffer size and the actual update rate. This VI keeps track of the phase of the waveform to ensure that the generated signal is continuous.
6. Write the waveform to the output buffer.
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.

IV. I/O Connections Overview:
Make sure your signal output terminal matches the Physical Channel I/O Control. For further connection information, refer to your hardware reference manual.

This VI updates the analog output waveform as rapidly as possible. When it updates the waveform the the new buffer will most likely be out of phase with the old buffer.

Back to Top

Customer Reviews
1 Review | Submit your review

  - Jan 14, 2014

Can you please clarify III.5 and the Note at the bottom. They seem to directly contradict each other.

Bookmark & Share






Rate this document

Answered Your Question?
Yes No