LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering noise pulse in a PWM measurement

I am using the counter on an NI-6602 interface in conjunction with LabVIEW 8.0 to perform PWM measurements on a digital signal. 
 
During some pulses the counter performs two measurements where it should only being measuring once.  Here is an example to illustrate this further.
 
Say the input signal is a 320us pulse...  One would expect a PWM measurement of 320us.  In my case sometimes the PWM measures the 320us but does it in two pulses, perhaps a 200us pulse followed by a 120us pulse.  I am assuming the input signal drops below the count threshold of the 6602.
 
I would like to filter out these pulses in LabVIEW software.   Is there a slick way to do this?
 
Can the counter threshold of the 6602 be configured?  Perhaps through MAX?
 
Any help on this issue would be greatly appreciated.
 
S. LaCoursiere
 
0 Kudos
Message 1 of 4
(3,149 Views)

There are some options available for performing digital filtering on specific PFI pins of the 6602.  It's been many years since I fiddled with that filtering feature under traditional NI-DAQ, but there seemed to be some quirks or side effects I wasn't willing to live with.  These may or may not apply nowadays under DAQmx (or maybe they never did and I just didn't pursue it hard enough...). 

I chose to deal with spurious noise spikes with a crude software filtering technique that worked for my particular situation.  It largely depends on expecting a pretty stable & constant value for the intervals being measured.  The basic idea behind it goes like this:

1. Find the median value of the measured intervals.  The median isn't much influenced by these noise glitches or outliers the way a mean might be.

2. Look for candidate noise glitches.  If your nominal interval times are pretty steady, these aren't hard to find.  For example, if you're expecting a high time of about 320 usec and there's a glitch somewhere in there, then one of the two measured high times must be less than 1/2 of the true high time.

3. Once you find this way-too-short interval, look at its neighbors.  In most cases, it'll be fairly clear which neighbor is a full interval and which is the other "half."

4. If you're measuring semi-periods, there'll also be a very short low time measurement in between those two "halves."  Add this time to the two "halves" to reconstruct your true high time.

5. Problems: algorithm needs to get significantly more sophisiticated if there are 2+ noise glitches within one true interval.  Also, if actual signal has a highly variable duty cycle, especially one that changes very suddenly, this kind of algorithm may not stand much chance of helping.

-Kevin P.

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 4
(3,140 Views)
Kevin P.,

Thanks for the fast reply.  Unfortunately the signal I am measuring does have a varying duty cycle.  I do llike the algorithm, perhaps I can use it in the future. 

Thanks.

S. LaCoursiere

0 Kudos
Message 3 of 4
(3,132 Views)
Hello S. LaCoursiere,

One important thing to consider, is the signal that you are feeding the counter is a clean TTL signal. If it isn't clean you can try building pull up/pull down network external circuitry to correct this. I can't think of an algorithm that would work with highly variable PWMs.

Regards,
   Sandra T.

Applications Engineer | National Instruments
0 Kudos
Message 4 of 4
(3,105 Views)