From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Enabling Digital Filtering Using Dummy Counter

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

Description

Overview:
Demonstrates on enabling digital filtering on any PFI line on an M Series DAQ Device by using a Dummy Counter.

Descriptions:
When acquiring digital signals in an industrial or otherwise electromagnetic noisy environment, it is common to see some bounces on the acquired signals whenever the signal changes state. These bounces appear as extra pulses close to the actual transition of a digital signal. When processing digital signals for pulse counts such as a quadrature encoded value, it is desirable to avoid theses bounces or eliminate them before processing the signal. This type of filtering or processing is commonly called debouncing as it removes the bounces from the digital signal.

Digital filters (digital debounce filters) can be implemented on the device's PFI line(s) to eliminate noise, unexpected, inaccurate, or incorrect counts on any counter tasks with sensors like the encoder.

On National Instruments M Series (62xx) DAQ Devices it is possible to enable digital debouncing filters on PFI lines used in Counter tasks.  
This example program configures a Dummy Task for the purpose of enabling the debouncing filter.  
The PFI Line will continue to use the filter until the device is reset or the filter is disabled explicitly (due to the "Lazy Uncommit" behavior of NI-DAQmx).

Refer to these links for more information:

  1. Debounce Digital Filtering with NI 62xx M Series and cDAQ
  2. How Do I Remove Glitches From My Digital Input or Output Signal?


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

Steps to Implement or Execute Code:

  1. Specify all the control on the front panel. For M Series devices the valid values for the minimum digital pulse width are 0s, 2.56ms, 6.425us and 125ns.
  2. Run this VI.

 

Block Diagram Steps:

  1. Creates an analog input voltage channel.
  2. Sets the parameters for the input terminal of the counter and enable the digital filtering on that trigger source.
  3. Calls the Start VI to start the acquisition. Also, commit the task so that the specifications that were made will be applied to the counter input, without actually starting the acquisition.
  4. Calls the Clear Task VI to clear the task.
  5. Uses the popup dialog box to display any error or warning.

 

 

Front Panel.PNG

 

Block Diagram.PNG

 

**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.