Example Code

Synchronize NI 9237 with NI 9401 at Low Frequencies in DAQmx

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 code will synchronize a 9237 strain task with a counter input task for frequencies lower than 1613 Hz.

Description

When measuring from a NI 9237, the minimum frequency is 1.613 kHz. For a counter measurement of frequency with a NI 9401, your sample clock rate must be slower than your measured frequency.  In the case that the measured frequency is less than sampling rate, you will get error -201314. This error instructs to lower the sample rate, which is impossible to do directly and still directly share the 9237 sample clock.

To lower the sampling rate of the 9401, you can use a counter output task to decimate the 9237 sample clock.  This will still allow the 9237 and 9401 measurements to be synchronized.

Requirements to Run

Software

  • LabVIEW 8.6 or compatible
  • DAQmx 9.5.1 or compatible

Hardware

  • NI 9237 module
  • NI 9401 module
  • NI 9174 or NI 9178 cDAQ Chassis; potentially works with others, unteested
  • Encoder
  • Bridge sensor


Steps to Implement or Execute Code

  1. Input your encoder to ctr0 of the 9401
  2. Externally wire PFI lines 0 and 7
  3. Wire your strain gauge channels to the 9237 as normal
  4. Adjust the frequency of the decimated 9237 timebase to be lower than your lowest expected frequency.  Do not measure an encoder at a frequency lower than your counter output task.  100 Hz is the default in this example.

Additional Information or References

Front Panel.JPG

VI Snippet.png

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

Patrick W.
Applications Engineer
National Instruments

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

Contributors