209
Atmel ATmega16/32/64/M1/C1 [DATASHEET]
7647K–AVR–12/13
Figure 18-14. Temperature Sensor Block Diagram
The measured voltage has a linear relationship to the temperature as described in
Table 18-3. The voltage sensitivity is
approximately 2.5mV/°C and the accuracy of the temperature measurement is ±10°C after bandgap calibration.
The values described in
Table 18-3 on page 209 are typical values. However, due to the process variation the temperature
sensor output voltage varies from one chip to another. To be capable of achieving more accurate results, the temperature
measurement can be calibrated in the application software.
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 ] – TOS } / k
where ADCH and ADCL are the ADC data registers, k is a fixed coefficient and TOS is the temperature sensor offset value
determined and stored into EEPROM.
18.8.2 Manufacturing Calibration
The calibration values are determined from values measured during test at room temperature which is approximately +25°C
and during test at hot temperature which is approximately +125°C. Calibration measures are done at VCC = 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.
Table 18-3. Temperature versus Sensor Output Voltage (Typical Case)
Temperature/°C
–40°C
+25°C
+125°C
Voltage/mV
600mV
762mv
1012mV
Temperature
Sensor
ADC Input
Multiplexer
Enable when
ADMUX = Temp. Sensor input
ADMUX
to sampling
and hold
G = 1