Example Code

Decrease the Sampling Rate of the NI 9237 DAQmx Strain Gage Task

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

For many strain gage tasks, a sampling rate lower than the valid NI-9237 sampling rates is necessary. The NI-9237 can only accepts specific sampling rates which can be found in the User Manual, or in this KnowledgeBase article link: What Are the Valid Sampling Rates for the NI 9233, NI 9234, and NI 9237? This example below can be used as a method to decrease the effective sampling rate of the NI-9237 to 100Hz.

Description

There are several methods to decimate the signal of the NI-9237, but this example uses finite acuqisition and takes the first of every 20 samples in a waveform using the Decimate 1D array function. The data is then displayed in an array and waveform graph. This example is configured to work with the valid sampling rate of 2kHz and 400 samples per channel. Because it only takes the first sample of every 20, the code outputs an array of 20 samples at the end of the acquisition. Additionally, it effectively samples at ~100Hz. This code will work for multiple channels on your device.

Requirements

Software

  • LabVIEW 2011 or compatible
  • DAQmx 9.3.5 or compatible

Hardware

  • NI 9237 in a compatible C Series Chassis
  • Strain gage to measure

Steps to Implement or Execute Code

  1. Configure your Strain Gage task to the specifications from your strain gage data sheet
  2. Set the number of samples per channel to 400, the divisor to 20, the rate to 2000Hz, and select the correct device and channels of your signal
  3. Run the task and obtain 20 data points of data at 100Hz

Additional Information and References

decimate_9237_sampling rate.png

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

Applications Engineer
National Instruments

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

Contributors