
458
42073A-MCU Wireless-02/13
ATmega2564/1284/644RFR2
27.9 Internal Temperature Measurement
The on-chip temperature can be measured using a special setup of the A/D converter
inputs. The integrated temperature sensor provides a linear, medium-accurate voltage
proportional to the absolute temperature (in Kelvin). This voltage is first amplified with
the programmable gain amplifier and then processed with the A/D converter. A low
frequency of the conversion clock must be selected due to the nature of the input
signal.
The absolute accuracy of the temperature measurement is limited by manufacturing
tolerances, noise from supply and ground voltages and the exactness of the reference
voltage. One time calibration at room temperature can easily compensate this
distribution.
The resolution of the temperature reading can be improved (<1K) by averaging (using
float numbers) or decimation (based on integer numbers) of multiple A/D conversion
results. In this way the impact of noise is reduced (see measurement results
The following table summarizes the preferred setup of the temperature measurement:
Table 27-8. Recommended ADC Setup for Temperature Measurement
Parameter
Register
Recommended Setup
ADC Channel
ADMUX,
ADCSRB
Select the Temperature Sensor, MUX4:0 = 01001;
MUX5 = 1;
ADC Clock
ADCSRA
Select a clock frequency of 500 kHz or lower;
VREF
ADMUX
Select the internal 1.6V reference voltage;
Start-up time
ADCSRC
Standard requirement of 20 s is sufficient;
Tracking time
ADCSRC
Setting ADTHT = 0 is sufficient;
Assembly Code Example
(1)
…
ldi
r17,(1<<ADEN)+(4<<ADPS0)
; enable the ADC, prescaler = 16
sts
ADCSRA, temp
wait_avdd_ok:
; wait for AVDD to come up
lds
r17, ADCSRB
sbrs r17, AVDDOK
rjmp wait_avdd_ok
; set start-up time to 80us (500kHz ADC clock)
ldi
r17, 10<<ADSUT0
sts
ADCSRC, temp
ldi
r17, 1<<MUX5
sts
ADCSRB, temp
; set MUX5 before MUX4:1
; 1.6V reference voltage + temperature sensor channel
ldi
r17, (3<<REFS0)+(9<<MUX0)
sts
ADMUX, temp
wait_vref_ok:
lds
r17, ADCSRB
; wait for reference voltage
sbrs r17, REFOK
rjmp wait_vref_ok