Example Code

Continuous Buffered Counter Input Period Measurement using 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.


  • Data Acquisition (DAQ)


  • LabVIEW


  • NI DAQmx

Code and Documents


Demonstrates on using NI-DAQmx API to measure the period of buffered counter input.

The counter will measure period on the input terminal of the counter specified in the Physical Channel I/O control.  To determine the default counter pins of a device or to set a different source (or gate) pin, refer to the Connecting Counter Signals topic in the NI-DAQmx Help (search for "Connecting Counter Signals").

LabVIEW 2012 or compatible.
NI-DAQmx 15.5.1 or compatible.

Steps to Implement or Execute Code:
1. Select the Physical Channel which corresponds to the counter you want to measure period on the DAQ device.
2. Enter the Maximum and Minimum Value to specify the range or your unknown periods. Additionally, you can change the input terminal where the period is measured using the channel property node.
Note: It is important to set the Maximum and Minimum Values of your unknown period as accurately as possible so the best internal timebase can be chosen to minimize measurement error.
3. Run this VI and monitor the period readings on the Data indicator.  




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

John Passiak

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