Oscillator calibration register – osccal, External clock, Atmega16(l) – Rainbow Electronics ATmega64L User Manual
Page 28

28
ATmega16(L)
2466B–09/01
Oscillator Calibration Register
– OSCCAL
• Bits 7..0 - CAL7..0: Oscillator Calibration Value
Writing the calibration byte to this address will trim the internal oscillator to remove pro-
cess variations from the oscillator frequency. This is done automatically during chip
reset. When OSCCAL is zero, the lowest available frequency is chosen. Writing non-
zero values to this register will increase the frequency of the internal oscillator. Writing
$FF to the register gives the highest available frequency. The calibrated oscillator is
used to time EEPROM and Flash access. If EEPROM or Flash is written, do not cali-
brate to more than 10% above the nominal frequency. Otherwise, the EEPROM or Flash
write may fail. Note that the Oscillator is intended for calibration to 1.0 MHz, 2.0 MHz,
4.0 MHz, or 8.0 MHz. Tuning to other values is not guaranteed, as indicated in Table 11.
External Clock
To drive the device from an external clock source, XTAL1 should be driven as shown in
Figure 14. To run the device on an external clock, the CKSEL fuses must be pro-
grammed to “0000”. By programming the CKOPT fuse, the user can enable an internal
36 pF capacitor between XTAL1 and GND.
Figure 14. External Clock Drive Configuration
Bit
7
6
5
4
3
2
1
0
CAL7
CAL6
CAL5
CAL4
CAL3
CAL2
CAL1
CAL0
OSCCAL
Read/Write
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Initial Value
Device Specific Calibration Value
Table 11. Internal RC Oscillator Frequency Range.
OSCCAL Value
Min Frequency in Percentage of
Nominal Frequency (%)
Max Frequency in Percentage of
Nominal Frequency (%)
$00
50
100
$7F
75
150
$FF
100
200
EXTERNAL
CLOCK
SIGNAL