Measuring Frequency with NI 94xx Digital Input Module Using Scan Interface

Updated Nov 27, 2023

Environment

Software

  • LabVIEW Full
  • LabVIEW Base

Driver

  • NI-RIO (Legacy)

I would like to take a counter or frequency measurement with an NI 94xx digital input module in a CompactRIO(cRIO) using Specialty Digital Mode, but the data I am reading are all zeros. How do you configure the module for counter measurements.

In order to use the Specialty Digital Modes for the NI 94xx Digital Input Module, go through the following steps.
  1. Set up your CompactRIO project in Scan Mode, as described in Using NI CompactRIO Scan Mode wth NI LabVIEW Software
  2. Set up your project to match the project window shown in the figure below. Make sure your 94xx Digital Input Module is under the Chassis section of the project and not under an FPGA target, this will assure you are using Scan Mode.
  1. Configure The Specialty Digital mode in the the Module properties. Right-Click on the Module and select Properties; then select the Specialty Digital Configuration category like shown in the figure below. Here you can select one of four digital counter measurement modes as well as a quadrature encoder mode. The two following figures show how to set CTR0 to Count Edges mode and CTR1 to Frequency Measurement mode.

Note: For detailed information about each of the configuration options click the Help button in the lower right corner of the window. 



Note: Using a longer Frequency Timebase will give you a more stable measurement but it will update less often. 
 
  1. Create a Real-Time Host VI that can read counter values. The VI below shows a simple VI that will display the counter data to a numeric indicator as well as a chart.

This corresponding front panel shown at the bottom displays the counter data on a chart.  In this case, a 500 Hz signal is connected to both CTR0 and CTR1 so we can see both the counter and the frequency measurements for the same signal. The graph below shows that the frequency of the signal was around .5 kHz with some jitter (because it was software timed). We can also see the counter value increasing at a constant rate, as expected.

Additional Information

NI 9403, 9425, and 9426 modules do not support Specialty Digital Configuration.  For more information on the supported functionality for each of the digital input modules, refer to What C Series Modules Support Specialty Digital Functions in Scan Mode? for more information.