133
ATtiny25/45/85 [DATASHEET]
2586Q–AVR–08/2013
where VPOS is the voltage on the positive input pin, VNEG the voltage on the negative input pin, and VREF the
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 or 20x.
17.11.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 VPOS is the voltage on the positive input pin, VNEG the voltage on the negative input pin, and VREF 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 or 20x.
However, if the signal is not bipolar by nature (9 bits + sign as the 10th bit), this scheme loses one bit of the con-
verter 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 dif-
(ADC9 in ADCH). If the bit is one, the result is negative, and if this bit is zero, the result is positive.
17.12 Temperature Measurement
The temperature measurement is based on an on-chip temperature sensor that is coupled to a single ended ADC4
channel. Selecting the ADC4 channel by writing the MUX[3:0] bits in ADMUX register to “1111” enables the tem-
perature sensor. The internal 1.1V reference must also be selected for the ADC reference source in the
temperature sensor measurement. When the temperature sensor is enabled, the ADC converter can be used in
single conversion mode to measure the voltage over the temperature sensor.
The measured voltage has a linear relationship to the temperature as described in
Table 17-2 The sensitivity is
approximately 1 LSB /
C and the accuracy depends on the method of user calibration. Typically, the measurement
accuracy after a single temperature calibration is ±10C, assuming calibration at room temperature. Better
accuracies are achieved by using two temperature points for calibration.
The values described in
Table 17-2 are typical values. However, due to 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. The sofware calibration can be done using the formula:
T = k * [(ADCH << 8) | ADCL] + T
OS
ADC
V
POS
V
NEG
–
1024
V
REF
-------------------------------------------------------- GAIN
=
ADC
V
POS
V
NEG
–
512
V
REF
----------------------------------------------------- GAIN
=
Table 17-2.
Temperature vs. Sensor Output Voltage (Typical Case)
Temperature
-40
C+25C+85C
ADC
230 LSB
300 LSB
370 LSB