244
7647H–AVR–03/12
Atmel ATmega16/32/64/M1/C1
18.8.1 User Calibration
The software calibration requires that a calibration value is measured and stored in a register or
EEPROM for each chip. The software calibration can be done utilizing the formula:
T = { [ (ADCH << 8) | ADCL ] - T
OS
} / k
where ADCH & ADCL are the ADC data registers, k is a fixed coefficient and T
OS
is the temper-
ature sensor offset value determined and stored into EEPROM.
18.8.2 Manufacturing Calibration
One can also use the calibration values available in the signature row See “Reading the Signa-
ture Row from Software” on page 289.
The calibration values are determined from values measured during test at room temperature
which is approximatively +25°C and during test at hot temperature which is approximatively
+125°C. Calibration measures are done at V
CC
= 3V and with ADC in internal Vref (2.56V)
mode.
There are two algorithms for determining the Centigrade Temperature
formula 1 for ATmega32 up to rev B
formula 2 for ATmega16/64 and ATmega32 rev C.
formula 1: Temp_C = (((ADC_ts - 273)* TS_Gain) / 128) + TS_Offset [Applicable to devices with
0xFF or 0x42 ('B') in the signature memory at address 0x003F]
formula 2: Temp_C = ((((ADC_ts -(298 - TS_Offset)) * TS_Gain) / 128) + 25 [Applicable to
devices with 0x43 ('C') in the signature memory at address 0x003F]
Where :
Temp_C is the result temperature in degrees centigrade.
ADC_ts is the 10 bit result the ADC returns from reading the temperature sensor.
TS_Gain is the unsigned fixed point 8-bit temperature sensor gain factor in 1/128th units stored
as previously in the signature row at address 0x0007.
TS_Offset is the signed twos complement 7-bit temperature sensor offset reading stored as pre-
viously in the signature row at address 0x0005.
See section 24.7.10 in the ATmega32M1 Automotive datasheet for details of reading the Signa-
ture Row.