14
\$\begingroup\$

How fast is 1 MHz in an AVR microcontroller? Is it actually 1,000,000 Hz or is it 1,048,576 Hz (1,024 Hz * 1,024)?

\$\endgroup\$
7
  • 8
    \$\begingroup\$ outside of computer memory applications the si units are actual SI units. So Hz will be correct. \$\endgroup\$
    – Kortuk
    Feb 21, 2013 at 2:48
  • 5
    \$\begingroup\$ You would be better served to use an external crystal. The internal oscillator is awful. \$\endgroup\$
    – Matt Young
    Feb 21, 2013 at 2:49
  • \$\begingroup\$ @MattYoung Thanks for the tip. I wondered one time why my AVR timer circuit was off by a couple seconds per minute. ;) \$\endgroup\$
    – BenjiWiebe
    Feb 21, 2013 at 2:53
  • 9
    \$\begingroup\$ Nobody's insane enough to invent binary versions of hertz and still call them hertz, thank god. \$\endgroup\$ Feb 21, 2013 at 11:07
  • 1
    \$\begingroup\$ Most, if not all, AVR has the ability to slightly change the internal RC oscillator frequency by programming a register. You can use that register to get closer to the desired frequency, hence user calibration. \$\endgroup\$
    – jippie
    Feb 21, 2013 at 22:01

2 Answers 2

22
\$\begingroup\$

Hz are always SI units Mega = 10^6 or one million.

Strictly speaking 2^20 should use the Mi (Mebi) prefix for all applications. I know that those prefixes were codified rather late, but it was still in the 1990's and have been in popular usage for over a decade.

\$\endgroup\$
2
\$\begingroup\$

kilo = 1024 only for memory size terms, for others its kilo = 1000. Hope it answers your question.

\$\endgroup\$
1
  • \$\begingroup\$ Yes but only for coding purposes does kilo=1024. If you buy memory sticks or drives they use the SI value as a short hand. Read the small print for actual memory size. \$\endgroup\$ Feb 27, 2013 at 3:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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