Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital filter for shared PFI line

Hardware: PCI-6220
Driver: NI-DAQmx 7.3
Software: VC++ 6.0

I am using ctr0 for quadrature encoder measurements with the sample clock defined as PFI4, and ctr1 for low frequency measurements using PFI4 as the gate input (NOTE: both refer to PFI4). A square wave representing the 60 Hz line is fed into PFI4 and my expectations are that both counters will simultaneously get a reading at the line frequency. From that I can calculate velocity.

My problem is that when contactors open/close there is noise on PFI4 that I can't seem to get rid of using shielded cabling and analog filters. The result is hundreds of readings (both encoder and frequency) in a single line cycle when this happens.

From the help I have tried to implement a digital filter on the input using the following commands:

DAQmxSetDIDigFltrEnable(m_hEncHandle, "/Dev1/PFI4", TRUE);
DAQmxSetDIDigFltrMinPulseWidth(m_hEncHandle, "/Dev1/PFI4", .002);

I can't be sure this is correct, but it does not seem to be working even with times as high as .004 which is half the length of the expected on or off time. I do not have problems with the encoder counts themselves, only the sample clock.

Ed
0 Kudos
Message 1 of 8
(5,529 Views)
To use the PFI line filters for counters, you need to use the filter enable for each terminal type. For the frequency measurement task, you need to enable the filter using DAQmxSetCIFreqDigFltrEnable() and DAQmxSetCIFreqDigFltrMinPulseWidth() and for the position measurement task, use DAQmxSetSampClkDigFltrEnable() and DAQmxSetSampClkDigFltrMinPulseWidth(). Both must be configured to use the same filter value, otherwise you will receive an error.

I hope this helps!
gus....
0 Kudos
Message 2 of 8
(5,517 Views)
Gus, you probably have it based on what I've read. My biggest problem is that there are soooo many different function calls available in NI-DAQmx and I'm having trouble locating the correct one in many cases.

Now that you point these out that are specific to frequency and sample clock filtering it appears obvious, but when you don't know what you are looking for it is tough. Thanks, and I will try these out right away.

Ed
0 Kudos
Message 3 of 8
(5,513 Views)
The digital filter appears to be working using the .00256 setting; more testing today will verify this. The "jitter" that was expected is noticable and this also reduces the resolution of the measurement. I am wondering if the filter widtth (0.0, .00256, 6.425e-6, 1.25e-7) relates to the resulting resolution and how that actually works?

Ed
0 Kudos
Message 4 of 8
(5,510 Views)
I'm not sure I understand your question, but let me take a stab at it. Because you have a .00256 low pass filter, the smallest period you are going to be able to measure is twice that (.00256 minimum for each high and low pulse). Does this answer your question?

gus....
0 Kudos
Message 5 of 8
(5,493 Views)
No, what I am interested in is the resolution of the measurement. Without a filter the 20 MHz timebase should provide 50 nano-second resolution (1/20 MHz), but when I utilize the .00256 width filter my resolution becomes 10 micro-seconds for the low-frequency measurement.

I would like to understand this better.

Ed
0 Kudos
Message 6 of 8
(5,490 Views)
CVI developers, the function pannel for the DAQmxSetChanAttribute function needs TLC. Very little information is provided when you press enter in the value feild for example.
0 Kudos
Message 7 of 8
(4,694 Views)
Hi EP000,

The DAQmxSetChanAttribute can be used to set many different attributes. A list of these can be found when choosing an attribute to set or in the CVI help under Library Reference » NI-DAQmx Library » NI-DAQmx Properties for LabWindows CVI » List of Channel Properties. I assume since you posted in this forum that the attributes you are referring are looking at are the digital filter properties. The help for the value field will be change depending on the attribute. If there is a specific help file that needs to be improved, you can submit a product feedback at www.ni.com/contact.

Regards,
Kent
Applications Engineer
0 Kudos
Message 8 of 8
(4,680 Views)