AVR Tutorial: About the Clock Source
May 12, 2006
The 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.

Categories:
Robotics & Electronics
Copyright © 2004 - 2010 Micah Carrick. All Rights Reserved.
2 Comments about "AVR Tutorial: About the Clock Source"
RSS Feed
have you tested reliability of UART communication using 1MHz RC ? Would it work with devices such as http://www.microvga.com/ ?
Thanks
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
Leave a Comment about "AVR Tutorial: About the Clock Source"