Main Content

22 Bit binary counter for Atmega328

This program will not work on an Arduino Uno. It makes use of features of the Atmega328 chip that are not available on the Arduino. The pins on the 328, and all Atmel microcontrollers, are arranged in banks of eight. The “D” bank is available but you only have full access to the one bank. There are only six pins available on the “C” bank, the analog input pins, because one of them is not broken out and the other is the reset. Two of the pins on the “B” bank are taken up by the crystal. It is possible to run the chip without the crystal and have full access to all eight pins on the “B” bank. There is an internal R/C network that can be used to clock the chip. The chip will run at eight MHz instead of sixteen. This is usually not a problem because most Arduino programs do not need the speed anyway. Also the internal clock is not as accurate. The tolerance specified in the datasheet for the ATtiny85 is +/- ten percent while most crystals have a tolerance of 30 PPM. I would assume that the 328 is the same but I could not find it in the 328 datasheet. (The datasheet is hundreds of pages of very dry reading.) There is a very good chance your chip will not be off anywhere close to ten percent. This collection of instructables includes a test of the internal clock in the ATtiny85 chip. and explains how parts are tested to assure they are within tolerance.”

Link to article