Example Code

Create Downsampled Waveform from DAQmx Raw Data

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

The acquisition sample rate of a DAQmx task determines the amount of data collected over a given period of time. Sometimes the sample rate is hardware-limited, and the user would like to have less data to log or process. This VI allows the user to create a new waveform of data based on the sample rate and number of samples per read.

Description

The user selects a physical channel (a simulated device can work fine for this), choose the sample rate, and chooses the samples to read. If the user selects 10000 S/s, reads every 1000 samples, then the read rate would be 10 reads/s. During every read, the user has the option to average the samples read, take the first point of the samples read, or take the last point of the samples read. A new waveform is constructed from the downsampled data. This waveform is plotted along with the raw data waveform to visualize the effect of downsampling.

Requirements


Software

  • LabVIEW 2010 or compatible
  • DAQmx 9.1.5 or compatible

Hardware

  • Any configured DAQ hardware or a simulated DAQ device

Steps to Implement or Execute Code

  1. Select a physical channel (which can be from a simulated device) and set the voltage range.
  2. Configure the timing settings (clock source, sample rate, samples to read)
  3. Select the downsampling method (average, first point, last point)
  4. Run the VI and observe the differences in the waveforms

Additional Information or References


Front_Panel.PNG

Block_Diagram.png

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

Rick C.

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

Contributors