From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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

DAQmx Generate Acquired Data with Queues

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 NI-DAQmx example VI allows the user to acquire data on multiple analog input channels and generate this same data back out through analog output channels.

 

Description

The VI uses a producer/consumer architecture with queues to enable the input and output tasks to run independently.This architecture is most useful when acquiring data, performing processing, and then outputting the processed data back out. In this example, no processing is done, but if needed, it could be placed in its own loop as an intermediate step between the acquisition and generation loops. Of course, this would increase the delay between when the signal is acquired and generated back out, but it will be a constant delay and the generation data should not be underwritten.

 

Note that the delay between when the acquisition and generation starts will be dependant on the number of samples read by the first DAQmx Read (plus some small overhead for the software to queue/dequeue the data). For a simpler approach of reading and generating the data out with a programmable delay, please see the community example found here.

 

Requirements

Software

  • LabVIEW 2012 or compatible
  • NI-DAQmx 9.5.5 or compatible

Hardware

  • NI Multifunction DAQ Device

 

Steps to Implement or Execute Code

  1. Configure the parameter for the right channel and device
  2. Connect your hardware appropriately
  3. Run the VI

 

Additional Information or References

The following image shows the VI with a sine wave on ai1, which is then output to ao0 and read back in on ai2 to compare the delay.

搜狗截图17年01月23日1347_1.png

搜狗截图17年01月23日1347_2.png

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

Daniel S.
National Instruments

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