OSCCAL – The Oscillator Calibration Register

When using the I/O specific commands IN and OUT, the I/O addresses 0x00 - 0x3F must be used. When addressing I/O Registers as data space using LD and ST instructions, 0x20 must be added to these offset addresses.

Name:
OSCCAL
Offset:
0x31
Reset:
0x00
Access:
When addressing I/O Registers as data space the offset address is 0x51
Bit76543210
CALn[7:0]
AccessR/WR/WR/WR/WR/WR/WR/WR/W
Resetxxxxxxxx

Bits 7:0 – CALn: Oscillator Calibration Value [n = 7:0]

Oscillator Calibration Value [n = 7:0]

Writing the calibration byte to this address will trim the Internal Oscillator to remove process variations from the Oscillator frequency. During Reset, the 1MHz calibration value which is located in the signature row High byte (address 0x00) is automatically loaded into the OSCCAL Register. If the internal RC is used at other frequencies, the calibration values must be loaded manually. This can be done by first reading the signature row by a programmer, and then store the calibration values in the Flash or EEPROM. Then the value can be read by software and loaded into the OSCCAL Register. 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 0xFF 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 calibrate 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, 2.0, 4.0, or 8.0MHz. Tuning to other values is not guaranteed, as indicated in the following table.

Note: The OSCCAL reset value is the device specific calibration value.
Table 1. Internal RC Oscillator Frequency Range
OSCCAL Value Min Frequency in Percentage of Nominal Frequency (%) Max Frequency in Percentage of Nominal Frequency (%)
0x00 50 100
0x7F 75 150
0xFF 100 200