Datasheet
289
7766F–AVR–11/10
ATmega16/32U4
23. Analog Comparator
The Analog Comparator compares the input values on the positive pin AIN+ and negative pin
AIN-. When the voltage on the positive pin AIN+ is higher than the voltage on the negative pin
AIN-, 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. AIN+ can be connected either to the AIN0 (PE6) pin, or to the internal
Bandgap reference. AIN- can only be connected to the ADC multiplexer.
The Power Reduction ADC bit, PRADC, in “Power Reduction Register 0 - PRR0” on page 46
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)
Notes: 1. See Table 23-2 on page 291.
2. Refer to “Pinout ATmega16U4/ATmega32U4” on page 3 and Table 10-3 on page 72 for Ana-
log Comparator pin placement.
23.0.1 ADC Control and Status Register B – ADCSRB
• Bit 6 – ACME: Analog Comparator Multiplexer Enable
When this bit is written logic one and the ADC is switched off (ADEN in ADCSRA is zero), the
ADC multiplexer is connected to the negative input to the Analog Comparator. When this bit is
written logic zero, the Bandgap reference is connected to the negative input of the Analog Com-
parator (See “Internal Voltage Reference” on page 54.). For a detailed description of this bit, see
“Analog Comparator Multiplexed Input” on page 291.
23.0.2 Analog Comparator Control and Status Register – ACSR
ACBG
BANDGAP
REFERENCE
ADC MULTIPLEXER
OUTPUT
ACME
ADEN
(1)
AIN+
AIN-
BANDGAP
REFERENCE
Bit 7 6543210
ADHSM ACME MUX5 – ADTS3 ADTS2 ADTS1 ADTS0 ADCSRB
Read/Write R R/W R R R R/W R/W R/W
Initial Value0 0000000
Bit 76543210
ACD ACBG ACO ACI ACIE ACIC ACIS1 ACIS0 ACSR
Read/Write R/W R/W R R/W R/W R/W R/W R/W
Initial Value 0 0 N/A 0 0 0 0 0