
- •Features
- •Pin Configuration
- •Disclaimer
- •Description
- •Pin Descriptions
- •AVCC
- •Port A (PA7..PA0)
- •Port B (PB7..PB0)
- •XTAL1
- •XTAL2
- •SRAM Data Memory
- •I/O Direct
- •Data Direct
- •Data Indirect with Displacement
- •Data Indirect
- •EEPROM Data Memory
- •I/O Memory
- •Status Register – SREG
- •Stack Pointer – SP
- •Reset Sources
- •Power-on Reset
- •External Reset
- •Brown-out Detection
- •Watchdog Reset
- •Clock Systems and their Distribution
- •CPU Clock – clkCPU
- •I/O Clock – clkI/O
- •Flash Clock – clkFLASH
- •ADC Clock – clkADC
- •Internal PLL for Fast Peripheral Clock Generation – clkPCK
- •Clock Sources
- •Crystal Oscillator
- •External RC Oscillator
- •External Clock
- •Interrupt Handling
- •Interrupt Response Time
- •External Interrupt
- •Pin Change Interrupt
- •Idle Mode
- •ADC Noise Reduction Mode
- •Power-down Mode
- •Standby Mode
- •Analog to Digital Converter
- •Analog Comparator
- •Brown-out Detector
- •Internal Voltage Reference
- •Watchdog Timer
- •Port Pins
- •Timer/Counters
- •Timer/Counter0 Prescaler
- •Timer/Counter1 Prescaler
- •8-bit Timer/Counter0
- •Timer/Counter0 – TCNT0
- •8-bit Timer/Counter1
- •Timer/Counter1 – TCNT1
- •Timer/Counter1 in PWM Mode
- •Watchdog Timer
- •Overview
- •Register Descriptions
- •USI Data Register – USIDR
- •USI Status Register – USISR
- •USI Control Register – USICR
- •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
- •ADC Conversion Result
- •ADLAR = 0
- •ADLAR = 1
- •I/O Ports
- •Introduction
- •Configuring the Pin
- •Reading the Pin Value
- •Alternate Port Functions
- •Alternate Functions of Port A
- •Alternate Functions Of Port B
- •Register Description for I/O Ports
- •Port A Data Register – PORTA
- •Port B Data Register – PORTB
- •Fuse Bits
- •Latching of Fuses
- •Signature Bytes
- •Calibration Byte
- •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*
- •External Clock Drive Waveforms
- •External Clock Drive
- •ADC Characteristics – Preliminary Data
- •ATtiny26/L Register Summary
- •Ordering Information(1)
- •Packaging Information
- •Data Sheet Change Log for ATtiny26
- •Changes from Rev. 1477A-03/02 to Rev. 1477B-04/02
- •Table of Contents

|
|
|
|
ATtiny26(L) |
|
|
|
|
|
||
|
Pin Descriptions |
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
VCC |
Digital supply voltage pin. |
|||
|
GND |
Digital ground pin. |
|||
|
AVCC |
AVCC is the supply voltage pin for Port A and the A/D Converter (ADC). It should be |
|||
|
|
externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be |
|||
|
|
connected to VCC through a low-pass filter. See page 77 for details on operating of the |
|||
|
|
ADC. |
|||
|
Port A (PA7..PA0) |
Port A is an 8-bit general purpose I/O port. PA7..PA0 are all I/O pins that can provide |
|||
|
|
internal pull-ups (selected for each bit). Port A has alternate functions as analog inputs |
|||
|
|
for the ADC and analog comparator and pin change interrupt as described in “Alternate |
|||
|
|
Port Functions” on page 95. |
|||
|
Port B (PB7..PB0) |
Port B is an 8-bit general purpose I/O port. PB6..0 are all I/O pins that can provide inter- |
|||
|
|
nal pull-ups (selected for each bit). PB7 is an I/O pin if not used as the reset. To use pin |
|||
|
|
PB7 as an I/O pin, instead of RESET pin, program (“0”) RSTDISBL Fuse. Port B has |
|||
|
|
alternate functions for the ADC, clocking, timer counters, USI, SPI programming, and |
|||
|
|
pin change interrupt as described in “Alternate Port Functions” on page 95. |
|||
|
|
|
|
pin. Reset pulses |
|
|
|
An External Reset is generated by a low level on the PB7/RESET |
|||
|
|
longer than 50 ns will generate a reset, even if the clock is not running. Shorter pulses |
|||
|
|
are not guaranteed to generate a reset. |
|||
|
XTAL1 |
Input to the inverting oscillator amplifier and input to the internal clock operating circuit. |
|||
|
XTAL2 |
Output from the inverting oscillator amplifier. |
5
1477B–AVR–04/02

Architectural
Overview
The fast-access Register File concept contains 32 x 8-bit general purpose working registers with a single clock cycle access time. This means that during one single clock cycle, one ALU (Arithmetic Logic Unit) operation is executed. Two operands are output from the Register File, the operation is executed, and the result is stored back in the Register File – in one clock cycle.
Six of the 32 registers can be used as 16-bit pointers for indirect memory access. These pointers are called the X-, Y-, and Z-pointers, and they can address the Register File and the Flash program memory.
Figure 2. The ATtiny26/L AVR Enhanced RISC Architecture
1024 x 16 Program FLASH
Instruction
Register
Instruction
Decoder
Control Lines
Program
Counter
Direct Addressing |
Indirect Addressing |
8-bit Data Bus
|
|
|
|
|
|
|
|
|
|
|
|
|
Control |
|
|
|
|
|
|
|
|
|
|
|
|
|
Registers |
|
|
Status |
|
|
|
|
|
|
|
|
|
||
|
|
||||||||||||
|
|
and Test |
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
Interrupt |
||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 x 8 |
Unit |
||||||||||
|
|
|
|||||||||||
|
|
|
|||||||||||
|
|
Universal |
|||||||||||
|
|
General |
|
|
Serial Interface |
||||||||
|
|
|
|||||||||||
|
|
Purpose |
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
||||
|
|
Registers |
|
||||||||||
|
|
ISP Unit |
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 x 8-bit |
|
|
ALU |
Timer/Counter |
||||||||||
|
|
|
|||||||||||
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Watchdog |
|
|
|
|
|
|
|
|
|
|
|
|
|
Timer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||||
|
|
128 x 8 |
|
ADC |
|||||||||
|
|
SRAM |
|
|
|
|
|
|
|
|
|
||
|
|
|
|
||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 byte |
|
Analog |
|||||||||
|
|
EEPROM |
|
|
|
|
|
|
|
Comparator |
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I/O Lines
The ALU supports arithmetic and logic functions between registers or between a constant and a register. Single register operations are also executed in the ALU. Figure 2 shows the ATtiny26/L AVR Enhanced RISC microcontroller architecture. In addition to the register operation, the conventional memory addressing modes can be used on the Register File as well. This is enabled by the fact that the Register File is assigned the 32 lowermost Data Space addresses ($00 - $1F), allowing them to be accessed as though they were ordinary memory locations.
The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, Timer/Counters, A/D Converters, and other I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations following those of the Register File, $20 - $5F.
The AVR uses a Harvard architecture concept with separate memories and buses for program and data memories. The program memory is accessed with a two stage
6 ATtiny26(L)
1477B–AVR–04/02

ATtiny26(L)
General Purpose
Register File
pipelining. While one instruction is being executed, the next instruction is pre-fetched from the program memory. This concept enables instructions to be executed in every clock cycle. The program memory is In-System programmable Flash memory.
With the relative jump and relative call instructions, the whole address space is directly accessed. All AVR instructions have a single 16-bit word format, meaning that every program memory address contains a single 16-bit instruction.
During interrupts and subroutine calls, the return address program counter (PC) is stored on the Stack. The Stack is effectively allocated in the general data SRAM, and consequently the stack size is only limited by the total SRAM size and the usage of the SRAM. All user programs must initialize the SP in the reset routine (before subroutines or interrupts are executed). The 8-bit Stack Pointer SP is read/write accessible in the I/O space. For programs written in C, the stack size must be declared in the linker file. Refer to the C user guide for more information.
The 128 bytes data SRAM can be easily accessed through the five different addressing modes supported in the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, Timer/Counters, and other I/O functions. The memory spaces in the AVR architecture are all linear and regular memory maps.
A flexible interrupt module has its control registers in the I/O space with an additional Global Interrupt Enable bit in the Status Register. All the different interrupts have a separate Interrupt Vector in the Interrupt Vector table at the beginning of the program memory. The different interrupts have priority in accordance with their Interrupt Vector position. The lower the Interrupt Vector address, the higher the priority.
Figure 3 shows the structure of the 32 general purpose working registers in the CPU.
Figure 3. AVR CPU General Purpose Working Registers
7 |
0 |
Addr. |
|
|
|
|
R0 |
$00 |
|
|
|
|
|
|
|
|
R1 |
$01 |
|
|
|
|
|
|
|
|
R2 |
$02 |
|
|
|
|
|
|
|
|
… |
|
|
|
|
|
|
|
|
|
R13 |
$0D |
|
|
|
|
|
|
General |
|
R14 |
$0E |
|
|
|
|
|
|
Purpose |
|
R15 |
$0F |
|
|
|
|
|
|
Working |
|
R16 |
$10 |
|
|
|
|
|
|
Registers |
|
R17 |
$11 |
|
|
|
|
|
|
|
|
… |
|
|
|
|
|
|
|
|
|
R26 |
$1A |
X-register Low Byte |
|
|
|
|
|
|
|
R27 |
$1B |
X-register High Byte |
|
|
|
|
|
|
|
R28 |
$1C |
Y-register Low Byte |
|
|
|
|
|
|
|
R29 |
$1D |
Y-register High Byte |
|
|
|
|
|
|
|
R30 |
$1E |
Z-register Low Byte |
|
|
|
|
|
|
|
R31 |
$1F |
Z-register High Byte |
|
|
|
|
|
7
1477B–AVR–04/02

All of the register operating instructions in the instruction set have direct and single cycle access to all registers. The only exceptions are the five constant arithmetic and logic instructions SBCI, SUBI, CPI, ANDI, and ORI between a constant and a register, and the LDI instruction for load immediate constant data. These instructions apply to the second half of the registers in the Register File – R16..R31. The general SBC, SUB, CP, AND, and OR, and all other operations between two registers or on a single register apply to the entire Register File.
As shown in Figure 3, each register is also assigned a data memory address, mapping them directly into the first 32 locations of the user Data Space. Although not being physically implemented as SRAM locations, this memory organization provides flexibility in access of the registers, as the X-, Y-, and Z-registers can be set to index any register in the file.
X-register, Y-register, and Z- The registers R26..R31 have some added functions to their general purpose usage. register These registers are address pointers for indirect addressing of the Data Space. The
three indirect address registers X, Y, and Z are defined as:
Figure 4. |
X-, Y-, and Z-register |
|
|
|
|
|
15 |
|
|
0 |
|
|
|
|
|
|
|
X-register |
|
7 |
0 |
7 |
0 |
|
|
|
|
|
|
|
|
R27 ($1B) |
|
R26 ($1A) |
|
|
15 |
|
|
0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
Y-register |
|
7 |
0 |
7 |
0 |
|
|
|
|
|
|
|
|
R29 ($1D) |
|
R28 ($1C) |
|
|
15 |
|
|
0 |
|
|
|
|
|
|
|
Z-register |
|
7 |
0 |
7 |
0 |
|
|
|
|
|
|
|
|
R31 ($1F) |
|
R30 ($1E) |
|
ALU – Arithmetic Logic
Unit
In the different addressing modes, these address registers have functions as fixed displacement, automatic increment and decrement (see the descriptions for the different instructions).
The high-performance AVR ALU operates in direct connection with all 32 general purpose working registers. Within a single clock cycle, ALU operations between registers in the Register File are executed. The ALU operations are divided into three main categories – Arithmetic, Logical, and Bit-functions.
8 ATtiny26(L)
1477B–AVR–04/02