- •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
• Bits 2..0 – ADPS2..0: ADC Prescaler Select Bits
These bits determine the division factor between the CK frequency and the input clock to the ADC.
Table 47. ADC Prescaler Selections
ADPS2 |
ADPS1 |
ADPS0 |
Division Factor |
|
|
|
|
0 |
0 |
0 |
2 |
|
|
|
|
0 |
0 |
1 |
2 |
|
|
|
|
0 |
1 |
0 |
4 |
|
|
|
|
0 |
1 |
1 |
8 |
|
|
|
|
1 |
0 |
0 |
16 |
|
|
|
|
1 |
0 |
1 |
32 |
|
|
|
|
1 |
1 |
0 |
64 |
|
|
|
|
1 |
1 |
1 |
128 |
|
|
|
|
ADC Data Register – ADCL
and ADCH
ADLAR = 0
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
|
$05 ($25) |
– |
– |
– |
– |
– |
– |
ADC9 |
ADC8 |
ADCH |
|
|
|
|
|
|
|
|
|
|
$04 ($24) |
ADC7 |
ADC6 |
ADC5 |
ADC4 |
ADC3 |
ADC2 |
ADC1 |
ADC0 |
ADCL |
|
|
|
|
|
|
|
|
|
|
|
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
|
Read/Write |
R |
R |
R |
R |
R |
R |
R |
R |
|
|
R |
R |
R |
R |
R |
R |
R |
R |
|
Initial Value |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
ADLAR = 1
Bit |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
|
$05 ($25) |
ADC9 |
ADC8 |
ADC7 |
ADC6 |
ADC5 |
ADC4 |
ADC3 |
ADC2 |
ADCH |
|
|
|
|
|
|
|
|
|
|
$04 ($24) |
ADC1 |
ADC0 |
– |
– |
– |
– |
– |
– |
ADCL |
|
|
|
|
|
|
|
|
|
|
|
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
|
Read/Write |
R |
R |
R |
R |
R |
R |
R |
R |
|
|
R |
R |
R |
R |
R |
R |
R |
R |
|
Initial Value |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
|
0 |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
|
When an ADC conversion is complete, the result is found in these two registers. The ADLAR bit in ADMUX affect the way the result is read from the registers. If ADLAR is set, the result is left adjusted. If ADLAR is cleared (default), the result is right adjusted. If the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read ADCH. Otherwise, ADCL must be read first, then ADCH.
• ADC9..0: ADC Conversion Result
These bits represent the result from the conversion. For differential channels, this is the absolute value after gain adjustment, as indicated in Table 46 on page 104. For single ended channels, $000 represents analog ground, and $3FF represents the selected reference voltage minus one LSB.
106 ATtiny26(L)
1477J–AVR–06/07
Scanning Multiple
Channels
ADC Noise Canceling
Techniques
Offset Compensation
Schemes
1477J–AVR–06/07
ATtiny26(L)
Since change of analog channel always is delayed until a conversion is finished, the Free Running mode can be used to scan multiple channels without interrupting the converter. Typically, the ADC Conversion Complete interrupt will be used to perform the channel shift. However, the user should take the following fact into consideration:
The interrupt triggers once the result is ready to be read. In Free Running mode, the next conversioin will start immediately when the interrupt triggers. If ADMUX is changed after the interrupt triggers, the next conversion has already started, and the old setting is used.
Digital circuitry inside and outside the ATtiny26(L) generates EMI which might affect the accuracy of analog measurements. If conversion accuracy is critical, the noise level can be reduced by applying the following techniques:
1.The analog part of the ATtiny26(L) and all analog components in the application should have a separate analog ground plane on the PCB. This ground plane is connected to the digital ground plane via a single point on the PCB.
2.Keep analog signal paths as short as possible. Make sure analog tracks run over the analog ground plane, and keep them well away from high-speed switching digital tracks.
3.The AVCC pin on the ATtiny26(L) should be connected to the digital VCC supply voltage via an LC network as shown in Figure 57.
4.Use the ADC noise canceler function to reduce induced noise from the CPU.
5.If some pins are used as digital outputs, it is essential that these do not switch while a conversion is in progress in that port.
The gain stage has a built-in offset cancellation circuitry that nulls the offset of differential measurements as much as possible. The remaining offset in the analog path can be measured directly by selecting the same channel for both differential inputs. This offset residue can be then subtracted in software from the measurement results. Using this kind of software based offset correction, offset on any channel can be reduced below one LSB.
107
Figure 57. ADC Power Connections
|
|
|
|
|
(MOSI/DI/SDA/OC1A) PB0 |
1 |
|
||
|
|
|
|
|
(MISO/DO/OC1A) PB1 |
2 |
|
||
|
|
|
|
|
(SCK/SCL/OC1B) PB2 |
3 |
|
||
|
|
|
|
|
(OC1B) PB3 |
4 |
|
||
|
|
VCC |
|
|
5 |
|
|||
|
|
|
|
|
|
|
GND |
|
ATtiny26/L |
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
(ADC7/XTAL1) PB4 |
7 |
|
||
|
|
|
|
|
|
|
|
|
|
(ADC8/XTAL2) PB5 |
8 |
|
||
|
|
|
|
|
(ADC9/INT0/T0) PB6 |
9 |
|
||
|
|
|
|
|
(ADC10/RESET) PB7 |
10 |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Plane |
20 |
|
|
PA0 (ADC0) |
|
|
Ground |
|||
|
|
||||||||
|
|
|
|
|
|||||
19 |
|
|
PA1 (ADC1) |
|
|
Analog |
|||
|
|
||||||||
|
|
|
|
|
|||||
18 |
|
|
PA2 (ADC2) |
|
|
|
|||
|
|
|
|
|
|||||
17 |
|
|
PA3 (AREF) |
|
|
|
|||
|
|
|
|
|
|||||
16 |
|
|
GND |
|
μΗ |
||||
|
|
||||||||
|
|
|
|
|
|
10 |
|||
|
|
|
|
|
|
|
|||
15 |
|
|
AVCC |
|
|
100nF |
|||
|
|
|
|
||||||
|
|
|
|||||||
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 PA4 (ADC3)
13 PA5 (ADC4)
12 PA6 (ADC5/AIN0)
11 PA7 (ADC6/AIN1)
108 ATtiny26(L)
1477J–AVR–06/07
Memory
Programming
Program and Data
Memory Lock Bits
1477J–AVR–06/07
ATtiny26(L)
The ATtiny26 provides two Lock bits which can be left unprogrammed (“1”) or can be programmed (“0”) to obtain the additional features listed in Table 49. The Lock bits can only be erased to “1” with the Chip Erase command.
Table 48. Lock Bit Byte(1)
Lock Bit Byte |
Bit No |
Description |
Default Value |
|
|
|
|
|
7 |
– |
1 (unprogrammed) |
|
|
|
|
|
6 |
– |
1 (unprogrammed) |
|
|
|
|
|
5 |
– |
1 (unprogrammed) |
|
|
|
|
|
4 |
– |
1 (unprogrammed) |
|
|
|
|
|
3 |
– |
1 (unprogrammed) |
|
|
|
|
|
2 |
– |
1 (unprogrammed) |
|
|
|
|
LB2 |
1 |
Lock bit |
1 (unprogrammed) |
|
|
|
|
LB1 |
0 |
Lock bit |
1 (unprogrammed) |
|
|
|
|
Note: 1. “1” means unprogrammed, “0” means programmed
Table 49. Lock Bit Protection Modes
Memory Lock Bits |
|
|
||
|
|
|
|
|
LB Mode |
LB2(2) |
|
LB1(2) |
Protection Type |
1 |
1 |
|
1 |
No memory lock features enabled. |
|
|
|
|
|
|
|
|
|
Further programming of the Flash and EEPROM is |
2 |
1 |
|
0 |
disabled in parallel and serial programming mode. The |
|
Fuse bits are locked in both serial and parallel |
|||
|
|
|
|
|
|
|
|
|
programming mode.(1) |
|
|
|
|
Further programming and verification of the Flash and |
3 |
0 |
|
0 |
EEPROM is disabled in parallel and serial programming |
|
mode. The Fuse bits are locked in both serial and parallel |
|||
|
|
|
|
|
|
|
|
|
programming mode.(1) |
Notes: 1. Program the Fuse bits before programming the Lock bits. 2. “1” means unprogrammed, “0” means programmed
109