OpenCores
no use no use 1/1 no use no use
how to calculate frequency of a signal using ADC outputsamples
by Unknown on Aug 25, 2006
Not available!
I'm no expert either, but I would start
trying to use the differential between samples,
this will avoid all troubles with zero crossings and dc-offsets but is
much easier than digital filtering.

As long as the sample frequency is not MUCH higher than the expected
frequency, you
should be all right counting the number of sign-changes (or the time /
mean time between sign changes).

This would be equivalent to count the number of maximas & minimas.

thus giving:
F = 2 / ( n * Sr)
n: number of samples between sign change
Sr: Time between samples

Colin Bathe wrote:
You can count the number of zero crossings in a known period of
time, hence

f=N/T, being N the number of crossings counted and T the amount of
time counting.

I'm no specialist but maybe that can be a good start.
That will only work if you have good zero crossing points which with an ADC you often don't. You can improve matters by filtering the data first if you know the expected operating frequency range and by adding hysterisis to the edge detection. Measuring the number of counts in a time period is only an accurate method if your time period starts and stops on an input edge. If you want to calculate the frequency by making a measurement over a fixed period, say 1 sec, then you can improve on the accuracy by measuring the number of counts and the time period between the last edge and the end of your time period. If tn = the time period between the last edge and the end of time period n Cn = the number of counts in time period n T = length of time period Then Fn = Cn / (T + tn-1 - tn) I use the above in an 8 bit micro to measure frequencies to 0.01Hz resolution with an 1 sec update rate. (There are lots of additional complications if you want to measure frequencies that are lower than 1/T) -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.405 / Virus Database: 268.11.5/426 - Release Date: 23/08/2006 _______________________________________________ http://www.opencores.org/mailman/listinfo/cores




no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.