Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxSetCIFreqDigFltr API

I am trying to set up Digital Filtering on the PFI lines of my M-series DAQ card that are used for Counter input.  I am using ANSI C to set this up.  I have come across the functions DAQmxSetCiFreqDigFltr and DAQmxSetCIFreqMinPulseWidth.  I am not able to find these functions or any other digital filter functions in my API or online.  I would just like to see what arguments the functions expect and what kinds of options they have.
0 Kudos
Message 1 of 4
(3,263 Views)
Hello Jbailey,

Welcome to the forums.
You will find most of these information in the properties section of the "NI-DAQmx C Reference Help". This is NI-DAQmx C Properties » List of Channel Properties.
The property you are looking for is called Counter Input » [Task] » Digital Filter. Where [Task] could be Frequency, Period, etc.

Then, you will see that the prototype is:

int32 __CFUNC DAQmxSetCIFreqDigFltrMinPulseWidth(TaskHandle taskHandle, const char channel[], float64 data);

Good luck,

Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 2 of 4
(3,254 Views)
Thank you for the direction.  I am still having problems with the filter though.  I am trying to filter out noise from an encoder signal with the digital filter but it seems to have no effect.  To verify this we ran our program with the min pulse width on the digital filter set to 1000000 seconds, many orders of magnitude higher than the noise and the desired signal itself.  My understanding is that this should remove all of the signals coming from the encoder and we should observe 0 pulses on the counter.  Yet when we run the program it still counts in the same manner it did before we even tried enabling the digital filter.  We have also tried setting the min pulse width to 0.000000001 and there's still no discernible effect.  My code is as follows:

    DAQmxSetCIFreqDigFltrEnable(taskHandle5, "/Dev1/PFI10", TRUE);
    DAQmxSetCIFreqDigFltrMinPulseWidth(taskHandle5, "/Dev1/PFI10", 0.001);
    DAQmxSetCIFreqDigFltrEnable(taskHandle5, "/Dev1/PFI8", TRUE);
    DAQmxSetCIFreqDigFltrMinPulseWidth(taskHandle5, "/Dev1/PFI8", 0.001);

Have I enabled the filter correctly?  Everything compiles and runs without errors.
0 Kudos
Message 3 of 4
(3,252 Views)
Hi Jbailey,

If you look at the DAQmx Help, you will find:

Digital debouncing filters are only supported on counter inputs. Each PFI line can independently select from three fixed values (125 ns, 6.425 µs, 2.55 ms). 
Search for "Digital Filtering Considerations ".

You will get an error -200077 if you do not set them to the exact value:

Property: CI.CountEdges.DigFltr.MinPulseWidth
You Have Requested:  3.000000
You Can Select:  0.000000,  2.560000e-3,  6.425000e-6,  125.0e-9


Looks like configuration is OK, you can see the results reading from a fast pulse train and you will count less pulses than expected.
Hope this helps,
Gerardo O.
RF SW Engineering R&D
National Instruments
0 Kudos
Message 4 of 4
(3,245 Views)