AVR Tutorial: About the Clock Source
May 12th, 2006The ATMega8 AVR is shipped with it's clock source configured to the internal 1MHz RC oscillator (see: "Calibrated Internal RC Oscillator" in the datasheet p.30). This configuration works fine for many small projects where timing isn't crucial and is also convenient as it reduces parts count (1 crystal and 2 capacitors). However, you may run in to situations where you need a more accurate clock source.
One example is when using the UART for serial communication. I use the serial port with the AVR quite freqently to serve as a debugging terminal and have run into problems using the internal oscillator in this case. Because of this, I have configured my AVR to use an external 8.000MHz crystal oscillator. The remaining tutorials will be tested using this 8.000MHz crystal. You can continue using your internal 1MHz clock and simply adjust the source code (#define F_CPU 1000000UL) or you can change your chip configuration to use an external crystal.

The crystal oscillator is connected to an AVR as shown above. In order to configure your chip to use an external crystal oscillator, you have to change the Fuse Bytes (see: "Fuse Bytes" in the datasheet p.223). An excelent fuse bytes how-to can be found here.
Categories
Popular Posts
RSS Feeds
Archives
July 22nd, 2008 at 4:39 am
Hi,
I am trying to use a TQFP Package ATmega8515 with an external crystal oscillator of 12 MHz. The problem is that within the STK500 Kit the oscillator provides a clock input and it works fine. But if I try to use the same controller on the PCB crystal does not give an output frequency. I have tried to use different capacitors - the datasheet says 12-22pF. Can capacitors of more value be used.
What else could I be doing wrong
I would appreciate help
Thanks
Mujahid