Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ Electronics
➜ Microprocessors
➜ Frequency counter
Postings by administrators only.
Refresh page
Posted by
| Willy
(4 posts) Bio
|
Date
| Wed 23 May 2012 12:29 PM (UTC) |
Message
| 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 24 May 2012 01:53 AM (UTC) |
Message
| 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? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Willy
(4 posts) Bio
|
Date
| Reply #2 on Thu 24 May 2012 05:45 AM (UTC) |
Message
| Hi, the question is how can I do that the frequency will be displayed with hertz separated by "." like "70.000.00"? | Top |
|
Posted by
| Nick Gammon
Australia (23,122 posts) Bio
Forum Administrator |
Date
| Reply #3 on Thu 24 May 2012 06:03 AM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Willy
(4 posts) Bio
|
Date
| Reply #4 on Thu 24 May 2012 07:04 AM (UTC) |
Message
| 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" | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
17,196 views.
Postings by administrators only.
Refresh page
top