Jason V,
thanks for your help. So there is no programable counter on the 5122...
-
My freuqency is constant and I need an accuracy of <1%.
What I did meanwhile:
I make a loop of e.g. 10 triggerevents.
I record the times when the trigger events occur.
After the loop I fit a line to the time vs. iteration number.
This gives a pretty good value for the period, hence I get the inverse frequency.
-
I need 10-30 trigger events to be accurate.
For 10 Hz this makes 1-3 seconds init at the start of each measurement.
I can reach a relative error as low as 1e-4. That's o.k.
-
I did some more tweaking to allow for missed trigger events.
The whole VI works fine to retrieve frequencies up to 100 Hz.
For higher frequencies I am limited due to the millisecond resolution of LabViews 'Tick' vi.
====
For higher frequencies I would program a counter:
Start a measurement for 1000 scans and measure the time for that.
However, this is not accurate enough for low frequencies and short recording times (10-30 trigger events).
====
I also thought about Fourier transforming the signal itself and locating the peak frequency.
Same as above: This is only accurate when I record many periods.
====
The fastest and most accurate solution would be to sample the trigger signal itself.
Then I would need only one period and could detect the trigger slopes with microsecond resolution.
However, I need both input channels for recording simultaneous signals.
Conclusion:
(1) The NI-5122 does not has a programable counter on board
(2) For my application I found a solution tht works.
Markus
Message Edited by Nepu on 03-09-2005 02:04 AM
Message Edited by Nepu on 03-09-2005 02:07 AM