Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Eliminating first bad reading on Low Frequency measurement

I have noticed when doing a low frequency measurement that the first reading of a group is always invalid, and the likely reason is that it is measuring the time from when the task started or armed to the first edge. This is creating a problem for me and I am looking for methods to eliminate it.

Another detail - I am currently using 2 counters both are configured for Arm Start Trigger to synchronize them, but this doesn't seem to affect the underlying problem of the first reading.

If I understand exactly how it works then I may be able to accommodate it, any explanations?

Ed
0 Kudos
Message 1 of 6
(3,848 Views)
Ed,

You're correct - the first count value to be buffered will be the "time" (literally the number of source edges) from when the counter is armed until the first Gate (sampling) edge. In a triggered operation it will be the time from the trigger edge until the first Gate edge.

There's really no way to eliminate this artifact except simply ignore the first value when evaluating period/frequency of the measured intervals. I don't think you can do any better than that. The only hw solution that *might* produce a buffer whose first value is "correct" would be to trigger off the same signal that is set up as the Gate. However, that would set up a race condition between the trigger and gate edge detection circuitry, and you may wind up with a first interval time of 0.

Can you describe why you can't just ignore the first value? Do you need to do a buffered measurement or could you simply take a single sample once in a while? With a single sample, the counter doesn't start counting time (source edges) until after it sees the first Gate edge, so your measurement would be correct.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 6
(3,842 Views)
I was not aware that single point samples would not have this problem, that is helpful for future applications. If this is the way it works then I will plan something to accommodate it, I just couldn't find anything explaining the behavior.

Another related question I need to be 100% sure about: I selected DAQmx_Val_Rising for my edge in DAQmxCreateCIFreqChan, and I want to verify that my samples are taken when the signal goes from 0 to 5V. Seems obvious, but I'm looking for the cause of a bug and need to rule this out.

Ed
0 Kudos
Message 3 of 6
(3,843 Views)
Sounds like you're making calls directly to the DAQmx driver dll. I'm afraid I can't help on this one -- I've only used LabVIEW vi's for any data acq work. Anyone else?

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 6
(3,838 Views)
Ed, What's the bug? I've done a fair bit of work with counters using CVI and may be able to help.

Jamie
0 Kudos
Message 5 of 6
(3,832 Views)
To verify that you are in fact measuring frequency on the rising edge, you can connect one counter to a frequency measurement counter, start a single point frequency measurement, then generate a single pulse on the other counter. You shouldn't see a data point until you generate a second pulse.

gus....
0 Kudos
Message 6 of 6
(3,796 Views)