Adc noise canceler function, Adc conversion result, Attiny26(l) – Rainbow Electronics ATtiny26L User Manual
Page 82
82
ATtiny26(L)
1477B–AVR–04/02
ADC Noise Canceler
Function
The ADC features a noise canceler that enables conversion during ADC Noise Reduc-
tion mode (see “Power Management and Sleep Modes” on page 41) to reduce noise
induced from the CPU core and other I/O peripherals. If other I/O peripherals must be
active during conversion, this mode works equivalently for Idle mode. To make use of
this feature, the following procedure should be used:
1.
Make sure that the ADC is enabled and is not busy converting. Single Conver-
sion mode must be selected and the ADC conversion complete interrupt must be
enabled.
ADEN = 1
ADSC = 0
ADFR = 0
ADIE = 1
2.
Enter ADC Noise Reduction mode (or Idle mode). The ADC will start a conver-
sion once the CPU has been halted.
3.
If no other interrupts occur before the ADC conversion completes, the ADC inter-
rupt will wake up the CPU and execute the ADC Conversion Complete interrupt
routine.
ADC Conversion Result
After the conversion is complete (ADIF is high), the conversion result can be found in
the ADC Result Registers (ADCL, ADCH).
For single ended conversion, the result is
where V
IN
is the voltage on the selected input pin and V
REF
the selected voltage refer-
ence (see Table 36 on page 84 and Table 37 on page 85). 0x000 represents analog
ground, and 0x3FF represents the selected reference voltage minus one LSB.
If differential channels 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, GAIN the selected gain factor, and V
REF
the selected voltage reference. Keep
in mind that V
POS
must be higher than V
NEG
, otherwise, the ADC value will saturate at
0x000. Figure 51 shows the decoding of the differential input range.
Table 35 shows the resulting output codes if the differential input channel pair (ADCn -
ADCm) is selected with a gain of GAIN and a reference voltage of V
REF
.
ADC
V
IN
1024
⋅
V
REF
--------------------------
=
ADC
V
POS
V
NEG
–
(
) GAIN 1024
⋅
⋅
V
REF
---------------------------------------------------------------------------
=