I have an oscillator which I need to measure using an AVR MCU running on an 8MHz Xtal. The output from the oscillator is driving the clock input of a 4024 counter. The freq. range on Q6 (input signal divided down by 128) is between 900 Hz and 140 KHz. My goal is to measure the freq. with the best precision I can using this simple hardware.

My plan is to enable the output from the counter (disable master reset) and measure the time it takes between that and until I detect a falling edge on Q6 which would mean counter overflow.

After I disable the master reset pin on the counter I start a counter running at 8MHz, when the falling edge on Q6 is detected the timer is stopped and the counter value is read. From these numbers I can calculate the input freq.

I'm wondering if this would be accurate enough?

  • \$\begingroup\$ Accurate enough for what? \$\endgroup\$ – Dave Kielpinski Jan 30 '15 at 9:15
  • \$\begingroup\$ @DaveKielpinski I need to construct a LUT according to the actual freq. measured so if I could be accurate to about 0.5% that would be good enough. \$\endgroup\$ – user34920 Jan 30 '15 at 10:21

Your basic idea looks good to me. There are a couple points to consider.

To get a precision of 0.5% in one run of your scheme, you would need to count at least 200 cycles, so you need at least an 8-bit counter. Looks like your 4024 counter only has 7 bits. However, that problem is easily overcome.

If you also need accuracy of 0.5%, you need to think about the accuracy of your 8 MHz crystal. (Here, precision means that your measurement is reproducible using the same setup. Accuracy means that your frequency measurement is tied to the SI second. Accuracy therefore guarantees that your measurement can be reproduced by anyone that builds a similar setup.) Basically, you are counting "ticks" of your unknown signal in terms of the "ticks" of the crystal oscillator. But what if you replace your crystal oscillator? The new one might have a different frequency. Then you would get a different answer, even if the frequency of the unknown signal didn't change.

I guess the frequency of a standard crystal oscillator is accurate to about 100 ppm = 0.1%, so you are probably OK. But check the datasheet for your crystal (again, for the accuracy spec, not precision or timing jitter).

Finally, you might worry about the precision of your crystal oscillator - exactly how periodic is the clock signal? But over these timescales I strongly suspect it will be fine at the 0.5% level. Again, you could check the datasheet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.