Frequency counter

Posted by Willy on Wed 23 May 2012 12:29 PM — 5 posts, 22,807 views.

#0
Hello, Nick! Thanks for your job! I have tried your frequency counter sketch for Atmega328. I have modified slightly the code for my purposes to use LCD display and pre-scaler 1/10 with 74HC4017. It works fine up to 70MHz, however on high frequency's LCD shows 69.999 instead 70.000 MHz, but I don't need hight resolution, only 1KHz.
Australia Forum Administrator #1
OK, great! I see that the 74HC4017 divides stuff down for you.

So is that a question? Or are you just saying how well it works?
#2
Hi, the question is how can I do that the frequency will be displayed with hertz separated by "." like "70.000.00"?
Australia Forum Administrator #3
You want a "thousands separator"?

Not sure of an easy way to do that. sprintf the number, and if it is larger than 1000 throw in a comma. This is just a formatting issue.
#4
I do like this
 float frq = timerCounts * 10.0 /  timerPeriod;
  frq = frq / 1000.0;
  lcd.clear();
  lcd.print (" F = ");
  lcd.print (frq,3);
  lcd.print (" MHz");

and display shows "F = 70.000 MHz"