3 bipolar differential conversion, 9 temperature measurement – Rainbow Electronics ATtiny861_V User Manual
Page 153

153
2588B–AVR–11/06
ATtiny261/461/861
155
). The voltage on the positive pin must always be larger than the voltage on the negative pin
or otherwise the voltage difference is saturated to zero. The result is presented in one-sided
form, from 0x000 (0d) to 0x3FF (+1023d). The GAIN is either 1x, 8x, 20x or 32x.
19.8.3
Bipolar Differential Conversion
As default the ADC converter operates in the unipolar input mode, but the bipolar input mode
can be selected by writting the BIN bit in the ADCSRB to one. In the bipolar input mode two-
sided voltage differences are allowed and thus the voltage on the negative input pin can also be
larger than the voltage on the positive input pin. If differential channels and a bipolar input mode
are used, the result is
where V
POS
is the voltage on the positive input pin, V
NEG
the voltage on the negative input pin,
and V
REF
the selected voltage reference. The result is presented in two’s complement form, from
0x200 (-512d) through 0x000 (+0d) to 0x1FF (+511d). The GAIN is either 1x, 8x, 20x or 32x.
However, if the signal is not bipolar by nature (9 bits + sign as the 10th bit), this scheme loses
one bit of the converter dynamic range. Then, if the user wants to perform the conversion with
the maximum dynamic range, the user can perform a quick polarity check of the result and use
the unipolar differential conversion with selectable differential input pair. When the polarity check
is performed, it is sufficient to read the MSB of the result (ADC9 in ADCH). If the bit is one, the
result is negative, and if this bit is zero, the result is positive.
19.9
Temperature Measurement
The temperature measurement is based on an on-chip temperature sensor that is coupled to a
single ended ADC11 channel. Selecting the ADC11 channel by writing the MUX5..0 bits in
ADMUX register to “111111” enables the temperature sensor. The internal 1.1V voltage refer-
ence must also be selected for the ADC voltage reference source in the temperature sensor
measurement. When the temperature sensor is enabled, the ADC converter can be used in sin-
gle conversion mode to measure the voltage over the temperature sensor.
The measured voltage has a linear relationship to the temperature as described in
Table 19-2 on
page 153
. The voltage sensitivity is approximately 1 mV/
°
C and the accuracy of the temperature
measurement is +/-
10
°
C after bandgap calibration.
The values described in
Table 19-2 on page 153
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 appli-
cation software. The software calibration requires that a calibration value is measured and
stored in a register or EEPROM for each chip. The sofware calibration can be done utilizing the
formula:
T = { [ (ADCH << 8) | ADCL ] - TOS } / k
ADC
V
POS
V
NEG
–
(
) 512
⋅
V
REF
----------------------------------------------------- GAIN
⋅
=
Table 19-2.
Temperature vs. Sensor Output Voltage (Typical Case)
Temperature /
°C
-40
°C
+25
°C
+85
°C
Voltage / mV
247 mV
314 mv
382 mV