Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NI-5122 measure trigger frequency of TTL trigger signal

I have two signal channels and a TTL trigger signal on my NI-5122. The frequency of the tigger signal is between 5 and 30 Hz. Before I want to sample the two signal channels I need to know the actual trigger frequency to calculate and set sampling rate and number of sampling points. I use LabView 7.1

What's the best way to measure the frequency (5-30 Hz) of the TTL signal connected to the 5122 trigger input?

many thanks for your help.
Markus
0 Kudos
Message 1 of 3
(3,090 Views)
I don't know of any way that the NI-5122 can directly measure frequency. I suppose you could perform a data acquisition of the voltage and then use a transfer function to obtain the frequency spectrum from that and find the maximum from there, but perhaps there is a better way.

Is the TTL signal a constant frequency, or does it vary each time you run your application? Also, how exactly does your sample rate and number of samples need to relate to the frequency of the trigger? If you can avoid needing to base these on the trigger signal's frequency, then your application can more easily be completed.
0 Kudos
Message 2 of 3
(3,054 Views)
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

0 Kudos
Message 3 of 3
(3,049 Views)