English
Language : 

ATMEGA48 Datasheet, PDF (241/377 Pages) ATMEL Corporation – 8-bit Microcontroller with 8K Bytes In-System Programmable Flash
ATmega48/88/168
23. Analog comparator
23.1 Overview
The Analog Comparator compares the input values on the positive pin AIN0 and negative pin
AIN1. When the voltage on the positive pin AIN0 is higher than the voltage on the negative pin
AIN1, the Analog Comparator output, ACO, is set. The comparator’s output can be set to trigger
the Timer/Counter1 Input Capture function. In addition, the comparator can trigger a separate
interrupt, exclusive to the Analog Comparator. The user can select Interrupt triggering on com-
parator output rise, fall or toggle. A block diagram of the comparator and its surrounding logic is
shown in Figure 23-1.
The Power Reduction ADC bit, PRADC, in “Minimizing power consumption” on page 41 must be
disabled by writing a logical zero to be able to use the ADC input MUX.
Figure 23-1. Analog comparator block diagram(2).
BANDGAP
REFERENCE
ACBG
ACME
ADEN
ADC MULTIPLEXER
OUTPUT (1)
Notes: 1. See Table 23-1.
2. Refer to Figure 1-1 on page 2 and Table 14-9 on page 84 for analog comparator pin
placement.
23.2
Analog comparator multiplexed input
It is possible to select any of the ADC7..0 pins to replace the negative input to the Analog Com-
parator. The ADC multiplexer is used to select this input, and consequently, the ADC must be
switched off to utilize this feature. If the Analog Comparator Multiplexer Enable bit (ACME in
ADCSRB) is set and the ADC is switched off (ADEN in ADCSRA is zero), MUX2..0 in ADMUX
select the input pin to replace the negative input to the Analog Comparator, as shown in Table
23-1. If ACME is cleared or ADEN is set, AIN1 is applied to the negative input to the Analog
Comparator.
Table 23-1.
ACME
0
1
1
Analog comparator multiplexed input.
ADEN
MUX2..0
Analog comparator negative input
x
xxx
AIN1
1
xxx
AIN1
0
000
ADC0
2545T–AVR–05/11
241