Dave,
I'd suggest you try to use a counter/timer based measurement rather than an analog measurement, subject to the following assumptions:
a) the sensor signal is (or can be made to be) TTL-compatible
b) you're using an E-series multifunction board with two DAQ-STC counter/timers
The advantage of the counter/timer method is that the time intervals are measured by the hardware, needing no analysis functions. Another likely advantage is that you can get 10 microsecond time resolution on the intervals while collecting only 1 data point per interval (except the very first which requires 2).
If you perform a buffered operation, you can be sure to capture
every interval. I'd recommend you look at the "measure buffered periods" examples under the LV help menu or here on the Dev Zone.
A couple other tips:
1. For your frequencies, you'll need to use the 100 kHz timebase, not the 20 MHz one which would "roll over" for frequencies under ~1Hz.
2. I'd recommend the use of a
median rather than a mean. If your environment produces an occasional noise glitch, the hardware may split a true interval into 2 apparent intervals, both of them wrong. One will be
at least 2x the true interval and can be more than 1000x. Either will distort a mean significantly. It would also likely distort a median of 3, but a median of 5 should be pretty robust. Can you live with a 5 sample moving average? (Note: this sensitivity to noise is a downside of using a counter rather than analog analysis).
3. With a max expected freq of about 100 Hz, you can probably just read 5 samples per loop and not have your app fall behind the hardware. The idea would be to decimate each set of 5 intervals into a single median value for your display. The programming for this will be simpler than a true moving window, though at the extreme of 0.1 Hz it'll take 50 seconds to update the calculated median.
Respond back here if you're on information overload and need some step-by-step definition of terms.
-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.