LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ frequency measurement using anolog input channel

Hello,
I try to develop a DAQ application which run on a real time target.
I want to measure frequency using anolo inpur channel of my DAQ card. I have a problem.
Let me first try to explain what i trying to do. In the first loop i do sampling and show the result as double array.
I need to show samples as double array so i can not read sample as waveform. With a shared variable i sent these samples to second loop.
First loop reriod is msec and second loops period is 20 msec.So when the second loop run, 20 samples were alraady ready, frequency measurement is done.
The problem is that i need to show frequency measurement as far as possible. Say frequency of my signal is about 100 hz, then this
configuration gives correct frequency measurement. But if frequency of the signal is about 10 hz, this configuration fails since period of second loop is 10 msec and it is not enough time to measure a 10 hz signal. But if i adjust period of the second loop as 100msec,
then i can measure 10 hz signal but then i can give measurement of a 100 hz signal  +90msec late. What can i do so i can measure frequency af signals ranges 0-100hz and give measurement result as far as possible?
0 Kudos
Message 1 of 11
(3,284 Views)

What signal are you dealing with??

is it an analog signal?? ( sinsusoidal, triangular, etc)

Or is it a TTL pulse??

0 Kudos
Message 2 of 11
(3,276 Views)
I'm dealing with anolog signals (sinusoid and square)
0 Kudos
Message 3 of 11
(3,272 Views)
Why not perform FFT/ Spectral measurements on the acquired signal to determine its frequency??
0 Kudos
Message 4 of 11
(3,266 Views)
I don't understand, what will change if i use FFT/ Spectral measurements on the acquired signal. How this solve my problem???
0 Kudos
Message 5 of 11
(3,238 Views)
0 Kudos
Message 6 of 11
(3,217 Views)

eesen,

What you are doing doesn't make any sense to me. First of all, you should take multiple samples with the DAQmx Read and not one sample at time with the timed loop. Your frequency measurement will then actually be more accurate. You also should return a waveform. That includes timing information that the Freq & Amp function needs to determine the frequency. It cannot do it with a dbl array. If you have to display a dbl, then just use the Get Waveform Components to extract the y array. You can get rid of the second timed loop and use a regular loop for the DAQmx Read. If you just set the rate to be twice the highest input frequency and acquire enough samples for a couple of cycles, you should have a pretty accurate reading.

0 Kudos
Message 7 of 11
(3,211 Views)

Thanks for repplies. You give  good points about frequency measurement, but advices gives no help for my real problem.:(

Let say i get rid of second loop and read samples as waveform. This doesn't solve my problem? I think, measuring frequency using anolog input channel in real time is not possible by software.

0 Kudos
Message 8 of 11
(3,196 Views)
Start with something simple like one of the shipping examples. Try Cont Acq&Graph Voltage-Int Clk and put the Extract Single Tone inside the while loop.
0 Kudos
Message 9 of 11
(3,192 Views)

I started with shipping examples. Since shipping examples don't satisfy my needs, i try to find another solution.

Thanks

0 Kudos
Message 10 of 11
(3,178 Views)