20. Analog Comparator
The analog comparator compares the input values on the positive pin ACMPx and negative pin ACMPM or ACMPMx.
20.1 Features
●
●
●
●
4 analog comparators
High-speed clocked comparators
4 reference levels
Generation of configurable interrupts
20.2 Overview
The ATmega16/32/64/M1/C1 features 4 fast analog comparators.
Each comparator has a dedicated input on the positive input, and the negative input of each comparator can be configured
as:
●
a steady value among the 4 internal reference levels defined by the Vref selected thanks to the REFS1:0 bits in
ADMUX register.
●
●
a value generated from the internal DAC
an external analog input ACMPMx.
When the voltage on the positive ACMPn pin is higher than the voltage selected by the ACnM multiplexer on the negative
input, the analog comparator output, ACnO, is set.
The comparator is a clocked comparator. The comparators can run with a clock frequency of up to 16MHz (typical value)
when the supply voltage is in the 4.5V-5.5V range and with a clock frequency of up to 8MHz (typical value) otherwise.
Each comparator can trigger a separate interrupt, exclusive to the analog comparator. In addition, the user can select
Interrupt triggering on comparator output rise, fall or toggle.
The interrupt flags can also be used to synchronize ADC or DAC conversions.
Moreover, the comparator’s output of the comparator 1 can be set to trigger the Timer/Counter1 Input Capture function.
A block diagram of the four comparators and their surrounding logic is shown in Figure 20-1 on page 226.
ATmega16/32/64/M1/C1 [DATASHEET]
225
7647O–AVR–01/15