Microcontroller has one CPU clock and that has been distributed in different types of its internal peripherals. Let’s look bellow –
In picture the main clock of the µC is F_CPU. Let’s the F_CPU=9MHz than new clock is 3MHz. Atmega8 has internal 8MHz and Atmega32 has internal 1MHz by default. For our operation clock cycle calculation is necessary. For example for proper ADC (Analog to Digital Conversion) function Atmega IC the F_ADC (clock frequency) is 50KHz to 200KHz. A normal conversion takes 13ADC cycle.
For any operation CPU clock is very important part because for every operation CPU need minimum 1clock cycle. The CPU of AVR has different types of clock cycle as follow-
Here we discuss about External Crystal/Ceramic Resonator and Calibrated Internal RC Oscillator.
External Crystal Oscillator:
XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be configured for use as an On-chip Oscillator, as shown in Figure 1. Either a quartz crystal or a ceramic resonator may be used. The CKOPT Fuse selects between two different Oscillator amplifier modes. Let’s see Crystal Oscillator Operating Modes
Those bits are found on High Fuse Byte and Low Fuse byte that will be discussed in burn section. The oscillator takes some time to operate. We can set the time according to the table-
To use a 32.768kHz watch crystal as the clock source for the device, the Low-frequency Crystal Oscillator must be selected by setting the CKSEL Fuses to “1001”. 32.768kHz crystal is used for time measurement purpose.
Calibrated Internal RC Oscillator :
The calibrated internal RC Oscillator provides a fixed 1.0MHz, 2.0MHz, 4.0MHz, or 8.0MHz clock. All frequencies are nominal values at 5V and 25°C. The CKOPT Fuse should always be unprogrammed(0) when using this clock option.