Datasheet

211
7728G–AVR–06/10
ATtiny87/ATtiny167
18. AnaComp - Analog Comparator
The Analog Comparator compares the input values on the positive pin (AIN1) and negative pin
(AIN0). When the voltage on the positive pin is higher than the voltage on the negative pin, the
Analog Comparator output, ACO, is set. The comparator can trigger a separate interrupt,
exclusive to the Analog Comparator. The user can select Interrupt triggering on comparator
output rise, fall or toggle. A block diagram of the comparator and its surrounding logic is shown
in Figure 18-1.
Figure 18-1. Analog Comparator Block Diagram
(1)(2)
Notes: 1. See Table 18-2 on page 214 and Table 18-3 on page 214
2. Refer to Figure 1-2 on page 5 and Table 9-3 on page 76 for Analog Comparator pin
placement.
18.1 Register Description
18.1.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 selects the positive input to the Analog Comparator. When this bit is written
logic zero, AIN1 is applied to the positive input of the Analog Comparator.
When the Analog to Digital Converter (ADC) is configured as single ended input channel, it is
possible to select any of the ADC[10..0] pins to replace the positive input to the Analog Com-
parator. The ADC multiplexer (MUX[4..0]) is used to select this input, and consequently, the
ADC must be switched off to utilize this feature.
Analog Comparator
Interrupt
Interrupt
Sensivity
Control
ACO
ACI
ACIE
ACIS0ACIS1
ACME
ACIRS
ADEN
16-bit Timer/Counter
Input Capture
AIN0
(PA6)
AIN1
(PA7)
REFS1
Internal
2.56 V
Reference
ACIR1
ACIR0
2.56 V
1.28 V
0.64 V
0.32 V
ACD
AVcc
(from ADC)
REFS0
(1)
ADC Multiplexer
Output
Bit 7 6543210
BIN ACME ACIR1 ACIR0 ADTS2 ADTS1 ADTS0 ADCSRB
Read/Write R R/W R/W R/W R R/W R/W R/W
Initial Value 00000000