- •Features
- •Pin Configuration
- •Description
- •Block Diagram
- •Pin Descriptions
- •AVCC
- •Port A (PA7..PA0)
- •Port B (PB7..PB0)
- •XTAL1
- •XTAL2
- •Resources
- •AVR CPU Core
- •Architectural Overview
- •I/O Direct
- •Data Direct
- •Data Indirect with Displacement
- •Data Indirect
- •Memories
- •SRAM Data Memory
- •EEPROM Data Memory
- •EEPROM Read/Write Access
- •I/O Memory
- •Clock Systems and their Distribution
- •Clock Sources
- •Default Clock Source
- •Crystal Oscillator
- •External RC Oscillator
- •External Clock
- •Power-on Reset
- •External Reset
- •Brown-out Detection
- •Watchdog Reset
- •Idle Mode
- •Power-down Mode
- •Standby Mode
- •Analog to Digital Converter
- •Analog Comparator
- •Brown-out Detector
- •Internal Voltage Reference
- •Watchdog Timer
- •Port Pins
- •I/O Ports
- •Introduction
- •Configuring the Pin
- •Reading the Pin Value
- •Unconnected Pins
- •Alternate Port Functions
- •Alternate Functions of Port A
- •Alternate Functions Of Port B
- •Register Description for I/O Ports
- •Interrupts
- •Interrupt Vectors
- •Interrupt Handling
- •Interrupt Response Time
- •External Interrupt
- •Pin Change Interrupt
- •Timer/Counters
- •Timer/Counter0 Prescaler
- •Timer/Counter1 Prescaler
- •8-bit Timer/Counter0
- •8-bit Timer/Counter1
- •Timer/Counter1 in PWM Mode
- •Watchdog Timer
- •Overview
- •Register Descriptions
- •Functional Descriptions
- •Three-wire Mode
- •SPI Slave Operation Example
- •Two-wire Mode
- •Start Condition Detector
- •Alternative USI Usage
- •4-bit Counter
- •12-bit Timer/Counter
- •Software Interrupt
- •Analog Comparator
- •Analog to Digital Converter
- •Features
- •Operation
- •Changing Channel or Reference Selection
- •ADC Conversion Result
- •ADLAR = 0
- •ADLAR = 1
- •Fuse Bits
- •Latching of Fuses
- •Signature Bytes
- •Calibration Byte
- •Page Size
- •Signal Names
- •Parallel Programming
- •Enter Programming Mode
- •Chip Erase
- •Programming the Flash
- •Programming the EEPROM
- •Reading the Flash
- •Reading the EEPROM
- •Programming the Lock Bits
- •Reading the Signature Bytes
- •Reading the Calibration Byte
- •Serial Downloading
- •Data Polling Flash
- •Data Polling EEPROM
- •Electrical Characteristics
- •Absolute Maximum Ratings*
- •DC Characteristics
- •External Clock Drive Waveforms
- •External Clock Drive
- •ADC Characteristics
- •Active Supply Current
- •Idle Supply Current
- •Power-down Supply Current
- •Standby Supply Current
- •Pin Pull-up
- •Internal Oscillator Speed
- •Register Summary
- •Instruction Set Summary
- •Ordering Information
- •Packaging Information
- •Errata
- •ATtiny26 Rev. B/C/D
- •Table of Contents
ATtiny26(L)
Analog Comparator The Analog Comparator compares the input values on the positive pin PA6 (AIN0) and negative pin PA7 (AIN1). When the voltage on the positive pin PA6 (AIN0) is higher than the voltage on the negative pin PA7 (AIN1), the Analog Comparator Output, ACO is set (one). The comparator’s output 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 the Figure 50.
Figure 50. Analog Comparator Block Diagram
ACBG
PA6
(AIN0)
MUX
PA7
(AIN1) MUX
ACME
ADC
MULTIPLEXER OUTPUT
Analog Comparator Control
and Status Register – ACSR
1477J–AVR–06/07
Bit |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
|
$08 ($28) |
ACD |
ACBG |
ACO |
ACI |
ACIE |
ACME |
ACIS1 |
ACIS0 |
ACSR |
|
|
|
|
|
|
|
|
|
|
Read/Write |
R/W |
R/W |
R |
R/W |
R/W |
R/W |
R/W |
R/W |
|
Initial Value |
0 |
0 |
X |
0 |
0 |
0 |
0 |
0 |
|
• Bit 7 – ACD: Analog Comparator Disable
When this bit is set(one), the power to the Analog Comparator is switched off. This bit can be set at any time to turn off the Analog Comparator. When changing the ACD bit, the Analog Comparator Interrupt must be disabled by clearing the ACIE bit in ACSR. Otherwise an interrupt can occur when the bit is changed.
• Bit 6 – ACBG: Analog Comparator Bandgap Select
When this bit is set (one), it selects internal bandgap reference voltage (1.18V) as the positive comparator input.
• Bit 5 – ACO: Analog Comparator Output
ACO is directly connected to the comparator output.
93
• Bit 4 – ACI: Analog Comparator Interrupt Flag
This bit is set (one) when a comparator output event triggers the interrupt mode defined by ACI1 and ACI0. The Analog Comparator Interrupt routine is executed if the ACIE bit is set (one) and the I-bit in SREG is set (one). ACI is cleared by hardware when executing the corresponding interrupt handling vector. Alternatively, ACI is cleared by writing a logic one to the flag.
• Bit 3 – ACIE: Analog Comparator Interrupt Enable
When the ACIE bit is set (one) and the I-bit in the Status Register is set (one), the Analog Comparator interrupt is activated. When cleared (zero), the interrupt is disabled.
• Bit 2 – ACME: Analog Comparator Multiplexer Enable
When the ACME bit is set (one) and the ADC is switched off (ADEN in ADCSR is zero), MUX3...0 in ADMUX select the input pin to replace the negative input to the Analog Comparator, as shown in Table 42 on page 95. If ACME is cleared (zero) or ADEN is set (one), PA7(AIN1) is applied to the negative input to the Analog Comparator.
• Bits 1, 0 – ACIS1, ACIS0: Analog Comparator Interrupt Mode Select
These bits determine which comparator events that trigger the Analog Comparator interrupt. The different settings are shown in Table 41.
Table 41. |
ACIS1/ACIS0 Settings(1) |
||
ACIS1 |
|
ACIS0 |
Interrupt Mode |
|
|
|
|
0 |
|
0 |
Comparator Interrupt on Output Toggle |
|
|
|
|
0 |
|
1 |
Reserved |
|
|
|
|
1 |
|
0 |
Comparator Interrupt on Falling Output Edge |
|
|
|
|
1 |
|
1 |
Comparator Interrupt on Rising Output Edge |
|
|
|
|
Note: 1. When changing the ACIS1/ACIS0 bits, the Analog Comparator Interrupt must be disabled by clearing its Interrupt Enable bit in the ACSR Register. Otherwise an interrupt can occur when the bits are changed.
94 ATtiny26(L)
1477J–AVR–06/07
|
|
|
|
|
|
|
ATtiny26(L) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table 42. Analog Comparator Input Selection(1) |
|||||
|
|
||||||
|
|
ACME |
|
ADEN |
MUX3...0(3) |
Analog Comparator Negative Input |
|
|
|
0 |
|
X |
XXXX |
AIN1 |
|
|
|
|
|
|
|
||
|
|
1 |
|
1 |
XXXX |
AIN1 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0000 |
ADC0 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0001 |
ADC1 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0010 |
ADC2 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0011 |
ADC3 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0100 |
ADC4 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0101 |
ADC5 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
0110 |
ADC6(2) |
|
|
|
1 |
|
0 |
0111 |
ADC7(2) |
|
|
|
1 |
|
0 |
1000 |
ADC8 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1001 |
ADC9 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1010 |
ADC10 |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1011 |
Undefined |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1100 |
Undefined |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1101 |
Undefined |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1110 |
Undefined |
|
|
|
|
|
|
|
||
|
|
1 |
|
0 |
1111 |
Undefined |
|
|
|
|
|
|
|
|
|
|
|
Notes: 1. |
MUX4 does not affect Analog Comparator input selection. |
2.Pin change interrupt on PA6 and PA7 is disabled if the Analog Comparator is enabled. This happens regardless of whether AIN1 or AIN0 has been replaced as inputs to the Analog Comparator.
3.The MUX3...0 selections go into effect after one clock cycle delay.
95
1477J–AVR–06/07