Features
High-performance, Low-power AVR 8-bit MicrocontrollerRISC Architecture
–118 Powerful Instructions – Most Single Clock Cycle Execution –32 x 8 General Purpose Working Registers–Fully Static Operation
–Up to 16 MIPS Throughput at 16 MHzData and Non-volatile Program Memory
–2K Bytes of In-System Programmable Program Memory FlashEndurance: 10,000 Write/Erase Cycles
–128 Bytes of In-System Programmable EEPROMEndurance: 100,000 Write/Erase Cycles–128 Bytes Internal SRAM
–Programming Lock for Flash Program and EEPROM Data Security ?Peripheral Features–8-bit Timer/Counter with Separate Prescaler–8-bit High-speed Timer with Separate Prescaler
2 High Frequency PWM Outputs with Separate Output Compare RegistersNon-overlapping Inverted PWM Output Pins
–Universal Serial Interface with Start Condition Detector–10-bit ADC
11 Single Ended Channels8 Differential ADC Channels
7 Differential ADC Channel Pairs with Programmable Gain (1x, 20x)–On-chip Analog Comparator–External Interrupt
–Pin Change Interrupt on 11 Pins
–Programmable Watchdog Timer with Separate On-chip Oscillator ?Special Microcontroller Features–Low Power Idle, Noise Reduction, and Power-down Modes–Power-on Reset and Programmable Brown-out Detection–External and Internal Interrupt Sources–In-System Programmable via SPI Port–Internal Calibrated RC OscillatorI/O and Packages
–20-lead PDIP/SOIC: 16 Programmable I/O Lines–32-lead QFN/MLF: 16 programmable I/O Lines
Operating Voltages–2.7V - 5.5V for ATtiny26L–4.5V - 5.5V for ATtiny26Speed Grades–0 - 8 MHz for ATtiny26L–0 - 16 MHz for ATtiny26
Power Consumption at 1 MHz, 3V and 25°C for ATtiny26L–Active 16 MHz, 5V and 25°C: Typ 15 mA–Active 1 MHz, 3V and 25°C: 0.70 mA–Idle Mode 1 MHz, 3V and 25°C: 0.18 mA–Power-down Mode: < 1 µA 8-bit Microcontrollerwith 2K BytesATtiny26ATtiny26L
2
ATtiny26(L)1477I–AVR–10/06Pin Configuration
Note:The bottom pad under the QFN/MLF package should be soldered to ground.
3
ATtiny26(L)1477I–AVR–10/06Description
The ATtiny26(L) is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executingpowerful instructions in a single clock cycle,the ATtiny26(L) achieves throughputs approaching 1 MIPS per MHz allowing thesystem designer to optimize power consumption versus processing speed.
The AVR core combines a rich instruction set with 32 general purpose working registers.All the 32 registers are directlyconnected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instructionexecuted in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten timesfaster than conventional CISC microcontrollers. The ATtiny26(L) has a high precision ADC with up to 11 single endedchannels and 8 differential channels. Seven differential channels have an optional gain of 20x. Four out of the seven
differential channels, which have the optional gain, can be used at the same time. The ATtiny26(L)also has a high frequency8-bit PWM module with two independent outputs. Two of the PWM outputs have inverted non-overlapping output pins idealfor synchronous rectifica-tion. The Universal Serial Interface of the ATtiny26(L) allows efficient software implementation ofTWI (Two-wire Serial Interface) or SM-bus interface. These features allow for highly integrated battery charger and lightingballast applications, low-end ther-mostats, and firedetectors, among other applications.
The ATtiny26(L) provides 2K bytes of Flash, 128 bytes EEPROM, 128 bytes SRAM, up to 16 general purpose I/O lines, 32general purpose working registers, two 8-bit Timer/Counters, one with PWM outputs, internal and external Oscillators,internal and external interrupts, programmable Watchdog Timer, 11-channel, 10-bit Analog to Digital Converter with twodifferential voltage input gain stages, and four software selectable power saving modes. The Idle mode stops the CPU whileallowing the Timer/Counters and interrupt system to continue functioning. The ATtiny26(L) also has a dedicated ADC NoiseReduction mode for reducing the noise in ADC conversion. In this sleep mode,only the ADC is functioning. The Power-downmode saves the register contents but freezes the oscillators, disabling all other chip functions until the next interrupt or hard-ware reset. The Standby mode is the same as the Power-down mode, but external oscillators are enabled. The wakeup orinterrupt on pin change features enable the ATtiny26(L) to be highly responsive to external events, still featuring the lowestpower consumption while in the Power-down mode.
The device is manufactured using Atmel’s high density non-volatile memory technology.By combining an enhanced RISC 8-bit CPU with Flash on a monolithic chip, the ATtiny26(L) is a powerful microcontroller that provides a highly flexible and costeffec-tive solution to many embedded control applications.
The ATtiny26(L) AVR is supported with a full suite of program and system development tools including: Macro assemblers,program debugger/simulators, In-circuit emulators,and evaluation kits.
4
ATtiny26(L)1477I–AVR–10/06Block Diagram
Figure 1. The ATtiny26(L) Block Diagram
5
ATtiny26(L)1477I–AVR–10/06Pin 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 V CC , even ifthe ADC is not used. If the ADC is used, it should be connected to V CC through a low-pass filter. See page 96 for details onoperating 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 48.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”) RSTDISBLFuse. Port B has alternate functions for the ADC, clocking, timer counters, USI, SPI programming, and pin change interruptas described in “Alternate Port Functions” on page 48.
longer than 50 ns will generate a reset, even if the clock is not running. Shorter pulses are not guaranteed to generate areset.
XTAL1Input to the inverting oscillator amplifier and input to the internal clock operating circuit.XTAL2
Output from the inverting oscillator amplifier.
6
ATtiny26(L)1477I–AVR–10/06Resources
A comprehensive set of development tools, application notes and datasheets are avail-able for download onhttp://www.doczj.com/doc/e728217f8e9951e79b892761.html /avr.7
ATtiny26(L)1477I–AVR–10/06About Code Examples
This datasheet contains simple code examples that briefly show how to use various parts of the device. These code
examples assume that the part specific header file is included before compilation. Be aware that not all C compiler vendorsinclude bit defini-tions in the header files and interrupt handling in C is compiler dependent. Please confirm with the Ccompiler documentation for more details.
8
ATtiny26(L)1477I–AVR–10/06AVR CPU CoreArchitectural Overview
The fast-access Register File concept contains 32 x 8-bit general purpose working reg-isters with a single clock cycle accesstime. This means that during one single clock cycle, one ALU (Arithmetic Logic Unit) operation is executed. Two operandsare output from the Register File, the operation is executed, and the result is stored back in the Register File – in one clockcycle.
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
The ALU supports arithmetic and logic functions between registers or between a con-stant and a register. Single registeroperations are also executed in the ALU. Figure 2shows 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 32lowermost Data Space addresses ($00 - $1F), allowingthem 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/DConverters, and other I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations followingthose of the Register File, $20 - $5F.
9
ATtiny26(L)1477I–AVR–10/06
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 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 programmemory is In-System programmable Flash memory.
With the relative jump and relative call instructions, the whole address space is directly accessed. All AVR instructions havea 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 andthe 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 mustbe 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 AVRarchitecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.The I/O memory space contains 64addresses for CPU peripheral functions as Control Registers, Timer/Counters, and other I/O functions. The memory spacesin 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 StatusRegister. All the different interrupts have a sep-arate Interrupt Vector in the Interrupt Vector table at the beginning of theprogram memory. The different interrupts have priority in accordance with their Interrupt Vector position. The lower theInterrupt Vector address, the higher the priority.General Purpose Register File
Figure 3 shows the structure of the 32 general purpose working registers in the CPU.Figure 3. AVR CPU General PurposeWorking Registers7
Addr.R0 $00R1$01R2$02…R13
$0D General R14$0E Purpose R15$0F Working R16$10RegistersR17$11
…R26$1A X-register Low Byte R27$1B X-register High Byte R28$1C Y-register Low Byte R29$1D Y-register High ByteR30$1E Z-register Low Byte R31$1F
Z-register High Byte
10
ATtiny26(L)1477I–AVR–10/06
All of the register operating instructions in the instruction set have direct and single cycle access to all registers. The onlyexceptions are the five constant arithmetic and logic instructions SBCI, SUBI, CPI, ANDI, and ORI between a constant and aregister, and the LDI instruction for load immediate constant data. These instructions apply to the second half of the registersin the Register File – R16..R31. The general SBC, SUB, CP,AND, and OR, and all other operations between two registers oron 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 locationsof the user Data Space. Although not being phys-ically implemented as SRAM locations, this memory organization providesflexibility 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-register
The registers R26..R31 have some added functions to their general purpose usage.These registers are address pointers forindirect addressing of the Data Space. The three indirect address registers X, Y, and Z are defined as:Figure 4. X-, Y -, andZ-register
In the different addressing modes, these address registers have functions as fixed dis-placement, automatic increment anddecrement (see the descriptions for the differentinstructions).
ALU – Arithmetic Logic Unit
The high-performance AVR ALU operates in direct connection with all 32 general pur-pose working registers. Within a singleclock cycle, ALU operations between registers in the Register File are executed. The ALU operations are divided into threemain catego-ries – Arithmetic, Logical, and Bit-functions.150X-register77 0R27 ($1B)R26 ($1A)150Y-register7 07 0R29 ($1D)R28 ($1C)150Z-register7 07 0R31 ($1F)R30 ($1E)11
ATtiny26(L)1477I–AVR–10/06Status Register – SREG
The AVR Status Register – SREG – at I/O space location $3F is defined as:
Bit 7 – I: Global Interrupt Enable
The Global Interrupt Enable bit must be set (one) for the interrupts to be enabled. The individual interrupt enable control isthen performed in the Interrupt Mask Registers –GIMSK and TIMSK. If the Global Interrupt Enable Register is cleared (zero),none of the interrupts are enabled independent of the GIMSK and TIMSK values. The I-bit is cleared by hardware after aninterrupt has occurred, and is set by the RETI instruction to enable subsequent interrupts. The I-bit can also be set and
cleared by the application with the SEI and CLI instructions, as described in the instruction set reference.?Bit 6 – T: Bit CopyStorage
The Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source and destination for the operated bit. Abit from a register in the Register File can be cop-ied into T by the BST instruction, and a bit in T can be copied into a bit in aregister in the Register File by the BLD instruction.?Bit 5 – H: Half Carry Flag
The Half Carry Flag H indicates a Half Carry in some arithmetic operations. See the Instruction Set Description for detailedinformation.?Bit 4 – S: Sign Bit, S = N ⊕ V
The S-bit is always an exclusive or between the Negative Flag N and the Two’s Comple-ment Overflow Flag V. See theInstruction Set Description for detailed information.?Bit 3 – V: Two’s Complement Overflow Flag
The Two’s Complement Overflow Flag V supports two’s complement arithmetics. See the Instruction Set Description fordetailed information.?Bit 2 – N: Negative Flag
The Negative Flag N indicates a negative result after the different arithmetic and logic operations. See the Instruction SetDescription for detailed information.?Bit 1 – Z: Zero Flag
The Zero Flag Z indicates a zero result after the different arithmetic and logic opera-tions. See the Instruction Set Descriptionfor detailed information.?Bit 0 – C: Carry Flag
The Carry Flag C indicates a carry in an arithmetic or logic operation. See the Instruction Set Description for detailedinformation.
Bit 76543210$3F ($5F)I T H S V N Z C SREG
Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value
12
ATtiny26(L)1477I–AVR–10/06Stack Pointer – SP
The ATtiny26(L) Stack Pointer is implemented as an 8-bit register in the I/O space loca-tion $3D ($5D). As the ATtiny26(L)data memory has 224 ($E0) locations, eight bits are used.
The Stack Pointer points to the data SRAM stack area where the Subroutine and Inter-rupt Stacks are located. This Stackspace in the data SRAM must be defined by the program before any subroutine calls are executed or interrupts are enabled.The Stack Pointer must be set to point above $60. The Stack Pointer is decremented by one when data is pushed onto theStack with the PUSH instruction, and it is decremented by two when an address is pushed onto the Stack with subroutinecalls and interrupts. The Stack Pointer is incremented by one when data is popped from the Stack with the POP instruction,and it is incremented by two when an address is popped from the Stack with return from subroutine RET or return frominterrupt RETI.
Program and Data Addressing Modes
The ATtiny26(L) AVR Enhanced RISC microcontroller supports powerful and efficient addressing modes for access to theFlash program memory, SRAM, Register File, and I/O Data memory. This section describes the different addressing modessupported by the AVR architecture. In the figures, OP means the operation code part of the instruction word. To simplify, notall figures show the exact location of the addressing bits.Register Direct, Single Register RdFigure 5. Direct Single Register AddressingThe operand is contained in register d (Rd).
Bit 76543210$3D ($5D)SP7SP6SP5SP4SP3SP2SP1SP0SPRead/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value
13
ATtiny26(L)1477I–AVR–10/06
Register Direct, Two Registers Rd and Rr
Figure 6. Direct Register Addressing, T wo Registers Operands are contained in register r (Rr) and d (Rd). The result isstored in register d (Rd).I/O Direct
Figure 7. I/O Direct Addressing
Operand address is contained in 6 bits of the instruction word. n is the destination or source register address.Data DirectFigure 8.
Direct Data Addressing
14
ATtiny26(L)1477I–AVR–10/06
A 16-bit Data Address is contained in the 16 LSBs of a two-word instruction. Rd/Rr specify the destination or source register.Data Indirect with Displacement
Figure 9. Data Indirect with Displacement
Operand address is the result of the Y- or Z-register contents added to the address con-tained in 6 bits of the instruction word.Data Indirect
Figure 10. Data Indirect Addressing
Operand address is the contents of the X-, Y-, or the Z-register.Data Indirect with Pre-decrement
Figure 11. Data Indirect Addressing with Pre-decrement
15
ATtiny26(L)1477I–AVR–10/06
The X-, Y-, or Z-register is decremented before the operation. Operand address is the decremented contents of the X-, Y-, orZ-register.
Data Indirect with Post-increment
Figure 12. Data Indirect Addressing with Post-increment
The X-, Y-, or Z-register is incremented after the operation. Operand address is the con-tent of the X-, Y-, or Z-register prior toincrementing.
Constant Addressing Using the LPM InstructionFigure 13. Code Memory Constant Addressing
Constant byte address is specified by the Z-register contents. The 15 MSBs select word address (0 - 1K), the LSB selectslow byte if cleared (LSB = 0) or high byte if set (LSB =1).
16
ATtiny26(L)1477I–AVR–10/06
Indirect Program Addressing, IJMP and ICALLFigure 14. Indirect Program Memory Addressing
Program execution continues at address contained by the Z-register (i.e., the PC is loaded with the contents of the Z-register).
Relative Program Addressing, RJMP and RCALL
Figure 15. Relative Program Memory Addressing Program execution continues at address PC + k + 1. The relative address kis from
-2048 to 2047.
17
ATtiny26(L)1477I–AVR–10/06Memories
The AVR CPU is driven by the System Clock ?, directly generated from the external clock crystal for the chip. No internalclock division is used.
Figure 16 shows the parallel instruction fetches and instruction executions enabled by the Harvard architecture and the fast-access Register File concept. This is the basic pipelining concept to obtain up to 1 MIPS per MHz with the correspondingunique results for functions per cost, functions per clocks, and functions per power-unit.Figure 16. The Parallel Instruction
Fetches and Instruction Executions
Figure 17 shows the internal timing concept for the Register File. In a single clock cycle an ALU operation using two registeroperands is executed, and the result is stored back to the destination register.Figure 17. Single Cycle ALU Operation
The internal data SRAM access is performed in two System Clock cycles as described in Figure 18.
18
ATtiny26(L)1477I–AVR–10/06
Figure 18. On-chip Data SRAM Access Cycles
In-System Programmable Flash Program Memory The ATtiny26(L) contains 2K bytes On-chip In-System ProgrammableFlash memory for program storage. Since all instructions are 16- or 32-bit words, the Flash is organized as
1K x 16. The Flash memory has an endurance of at least 10,000 write/erase cycles. The ATtiny26(L) Program Counter – PC– is 10 bits wide, thus addressing the 1024 program memory addresses, see “Memory Programming” on page 109 for adetailed description on Flash data downloading. See “Program and Data Addressing Modes” on page 12 for the differentprogram memory addressing modes.Figure 19. SRAM OrganizationSRAM Data Memory
Figure 19 above shows how the ATtiny26(L) SRAM Memory is organized.
The lower 224 Data Memory locations address the Register File, the I/O Memory and the internal data SRAM. The first 96locations address the Register File and I/O Mem-ory, and the next 128 locations address the internal data SRAM.
Register FileData Address Space
R0$0000R1$0001R2$0002......R29$001D R30$001E R31$001FI/O Registers
$00$0020$01$0021$02$0022……$3D $005D $3E $005E $3F$005F Internal SRAM$0060$0061...$00DE $00DF19
ATtiny26(L)1477I–AVR–10/06
The five different addressing modes for the data memory cover: Direct, Indirect with Dis-placement, Indirect, Indirect with Pre-decrement, and Indirect with Post-increment. In the Register File, registers R26 to R31 feature the indirect addressing pointerregisters.The direct addressing reaches the entire data space. The Indirect with Displacement mode features a 63 addresslocations reach from the base address given by the Y- or Z-register.
When using register indirect addressing modes with automatic pre-decrement and post-
increment, the address registers X, Y, and Z are decremented and incremented.The 32 general purpose working registers,64 I/O Registers and the 128 bytes of inter-nal data SRAM in the ATtiny26(L) are all accessible through all these addressingmodes.
See “Program and Data Addressing Modes” on page 12 for a detailed description of the different addressing modes.EEPROM Data Memory
The ATtiny26(L) contains 128 bytes of data EEPROM memory. It is organized as a sep-arate data space, in which singlebytes can be read and written (see “Memory Programming” on page 109). The EEPROM has an endurance of at least100,000write/erase cycles per location.EEPROM Read/Write Access
The EEPROM Access Registers are accessible in the I/O space.
The write access time is typically 8.3 ms. A self-timing function lets the user software detect when the next byte can bewritten. A special EEPROM Ready Interrupt can be set to trigger when the EEPROM is ready to accept new data.
An ongoing EEPROM write operation will complete even if a reset condition occurs.In order to prevent unintentional
EEPROM writes, a two state write procedure must be followed. Refer to the description of the EEPROM Control Register fordetails on this.When the EEPROM is written, the CPU is halted for two clock cycles before the next instruction is executed.When the EEPROM is read, the CPU is halted for four clock cycles before the next instruction is executed.EEPROM Address Register – EEARBit 7 – RES: Reserved Bits
This bit are reserved bit in the ATtiny26(L) and will always read as zero.?Bit 6..0 – EEAR6..0: EEPROM Address
The EEPROM Address Register – EEAR – specifies the EEPROM address in the 128bytes EEPROM space. The EEPROMdata bytes are addressed linearly between 0 and 127. The initial value of EEAR is undefined. A proper value must be writtenbefore the EEPROM may be accessed.
Bit 76543210$1E ($3E)–EEAR6EEAR5EEAR4EEAR3EEAR2EEAR1EEAR0EEARRead/Write R R/W R/W R/W R/W R/W R/W R/W Initial ValueXXXXXXX
因篇幅问题不能全部显示,请点此查看更多更全内容