Example Code

Producer/Consumer Read Waveform Data and Write to TDMS at Two Different Rates

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 explain how to use two different rates to read data from a DAQ device (waveform format) and write these data to a file in the HD.

Description

Using a Producer/Consumer structure, DAQmx reads data from the card buffer at one rate, and this information is written in a file slower (3 times slower in this example, but same structure can be use to write XX times slower just modifying few things). The example “Producer/Consumer pattern :: Read Double data from a device and write these data to TDMS file at two different rates.” write information 11 times slower.

Note that DAQmx also supports writing to TDMS directly from the API.


Requirements

Software

  • LabVIEW 8.2 or compatible
  • DAQmx 8.3 or compatible

Hardware

  • Most supported DAQ devices

Steps to Implement or Execute Code

  1. Select a single channel from a DAQ device in the control “Physical Channel” inside Channel Parameters group.
  2. Set the Max and Min value for this channel, the “Sample Rate” and the number of “Samples to Read” per iteration.

Additional Information or References

waveform.png

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

Contributors