Features * High Performance, Low Power AVR(R) 8-Bit Microcontroller * Advanced RISC Architecture * * * * * * * * - 120 Powerful Instructions - Most Single Clock Cycle Execution - 32 x 8 General Purpose Working Registers - Fully Static Operation Non-Volatile Program and Data Memories - 2/4/8K Bytes of In-System Programmable Program Memory Flash * Endurance: 10,000 Write/Erase Cycles - 128/256/512 Bytes of In-System Programmable EEPROM * Endurance: 100,000 Write/Erase Cycles - 128/256/512 Bytes of Internal SRAM - Data Retention: 20 years at 85C / 100 years at 25C - Programming Lock for Self-Programming Flash & EEPROM Data Security Peripheral Features - One 8-Bit and One 16-Bit Timer/Counter with Two PWM Channels, Each - 10-bit ADC * 8 Single-Ended Channels * 12 Differential ADC Channel Pairs with Programmable Gain (1x / 20x) - Programmable Watchdog Timer with Separate On-chip Oscillator - On-chip Analog Comparator - Universal Serial Interface Special Microcontroller Features - debugWIRE On-chip Debug System - In-System Programmable via SPI Port - Internal and External Interrupt Sources: Pin Change Interrupt on 12 Pins - Low Power Idle, ADC Noise Reduction, Standby and Power-Down Modes - Enhanced Power-on Reset Circuit - Programmable Brown-out Detection Circuit - Internal Calibrated Oscillator - On-chip Temperature Sensor I/O and Packages - Available in 20-Pin QFN/MLF & 14-Pin SOIC and PDIP - Twelve Programmable I/O Lines Operating Voltage: - 1.8 - 5.5V for ATtiny24V/44V/84V - 2.7 - 5.5V for ATtiny24/44/84 Speed Grade - ATtiny24V/44V/84V * 0 - 4 MHz @ 1.8 - 5.5V * 0 - 10 MHz @ 2.7 - 5.5V - ATtiny24/44/84 * 0 - 10 MHz @ 2.7 - 5.5V * 0 - 20 MHz @ 4.5 - 5.5V Industrial Temperature Range: -40C to +85C Low Power Consumption - Active Mode (1 MHz System Clock): 300 A @ 1.8V - Power-Down Mode: 0.1 A @ 1.8V 8-bit Microcontroller with 2/4/8K Bytes In-System Programmable Flash ATtiny24 ATtiny44 ATtiny84 Rev. 8006K-AVR-10/10 1. Pin Configurations Figure 1-1. Pinout ATtiny24/44/84 PDIP/SOIC VCC (PCINT8/XTAL1/CLKI) PB0 (PCINT9/XTAL2) PB1 (PCINT11/RESET/dW) PB3 (PCINT10/INT0/OC0A/CKOUT) PB2 (PCINT7/ICP/OC0B/ADC7) PA7 (PCINT6/OC1A/SDA/MOSI/DI/ADC6) PA6 1 2 3 4 5 6 7 14 13 12 11 10 9 8 GND PA0 (ADC0/AREF/PCINT0) PA1 (ADC1/AIN0/PCINT1) PA2 (ADC2/AIN1/PCINT2) PA3 (ADC3/T0/PCINT3) PA4 (ADC4/USCK/SCL/T1/PCINT4) PA5 (ADC5/DO/MISO/OC1B/PCINT5) NOTE Bottom pad should be soldered to ground. DNC: Do Not Connect 1.1 1.1.1 15 14 13 12 11 6 7 8 9 10 1 2 3 4 5 Pin 16: PA6 (PCINT6/OC1A/SDA/MOSI/DI/ADC6) Pin 20: PA5 (ADC5/DO/MISO/OC1B/PCINT5) PA7 (PCINT7/ICP/OC0B/ADC7) PB2 (PCINT10/INT0/OC0A/CKOUT) PB3 (PCINT11/RESET/dW) PB1 (PCINT9/XTAL2) PB0 (PCINT8/XTAL1/CLKI) DNC DNC GND VCC DNC (ADC4/USCK/SCL/T1/PCINT4) PA4 (ADC3/T0/PCINT3) PA3 (ADC2/AIN1/PCINT2) PA2 (ADC1/AIN0/PCINT1) PA1 (ADC0/AREF/PCINT0) PA0 20 19 18 17 16 PA5 DNC DNC DNC PA6 QFN/MLF Pin Descriptions VCC Supply voltage. 1.1.2 GND Ground. 1.1.3 2 Port B (PB3:PB0) Port B is a 4-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability except PB3 which has the RESET capability. To use pin PB3 as an I/O pin, instead of RESET pin, program (`0') RSTDISBL fuse. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Port B also serves the functions of various special features of the ATtiny24/44/84 as listed in Section 10.2 "Alternate Port Functions" on page 58. 1.1.4 RESET Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running and provided the reset pin has not been disabled. The minimum pulse length is given in Table 20-4 on page 177. Shorter pulses are not guaranteed to generate a reset. The reset pin can also be used as a (weak) I/O pin. 1.1.5 Port A (PA7:PA0) Port A is a 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port A pins that are externally pulled low will source current if the pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port A has alternate functions as analog inputs for the ADC, analog comparator, timer/counter, SPI and pin change interrupt as described in "Alternate Port Functions" on page 58. 3 8006K-AVR-10/10 2. Overview ATtiny24/44/84 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATtiny24/44/84 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed. Figure 2-1. Block Diagram VCC 8-BIT DATABUS INTERNAL OSCILLATOR INTERNAL CALIBRATED OSCILLATOR TIMING AND CONTROL GND PROGRAM COUNTER STACK POINTER WATCHDOG TIMER PROGRAM FLASH SRAM MCU CONTROL REGISTER INSTRUCTION REGISTER MCU STATUS REGISTER GENERAL PURPOSE REGISTERS TIMER/ COUNTER0 X Y Z INSTRUCTION DECODER TIMER/ COUNTER1 CONTROL LINES ALU STATUS REGISTER INTERRUPT UNIT ANALOG COMPARATOR + - PROGRAMMING LOGIC EEPROM ISP INTERFACE DATA REGISTER PORT A DATA DIR. REG.PORT A ADC OSCILLATORS DATA REGISTER PORT B DATA DIR. REG.PORT B PORT A DRIVERS PORT B DRIVERS PA7-PA0 PB3-PB0 The AVR core combines a rich instruction set with 32 general purpose working registers. All 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers. 4 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 The ATtiny24/44/84 provides the following features: 2/4/8K byte of In-System Programmable Flash, 128/256/512 bytes EEPROM, 128/256/512 bytes SRAM, 12 general purpose I/O lines, 32 general purpose working registers, an 8-bit Timer/Counter with two PWM channels, a 16-bit timer/counter with two PWM channels, Internal and External Interrupts, a 8-channel 10-bit ADC, programmable gain stage (1x, 20x) for 12 differential ADC channel pairs, a programmable Watchdog Timer with internal oscillator, internal calibrated oscillator, and four software selectable power saving modes. Idle mode stops the CPU while allowing the SRAM, Timer/Counter, ADC, Analog Comparator, and Interrupt system to continue functioning. ADC Noise Reduction mode minimizes switching noise during ADC conversions by stopping the CPU and all I/O modules except the ADC. In Power-down mode registers keep their contents and all chip functions are disbaled until the next interrupt or hardware reset. In Standby mode, the crystal/resonator oscillator is running while the rest of the device is sleeping, allowing very fast start-up combined with low power consumption. The device is manufactured using Atmel's high density non-volatile memory technology. The onchip ISP Flash allows the Program memory to be re-programmed in-system through an SPI serial interface, by a conventional non-volatile memory programmer or by an on-chip boot code running on the AVR core. The ATtiny24/44/84 AVR is supported with a full suite of program and system development tools including: C Compilers, Macro Assemblers, Program Debugger/Simulators and Evaluation kits. 5 8006K-AVR-10/10 3. About 3.1 Resources A comprehensive set of drivers, application notes, data sheets and descriptions on development tools are available for download at http://www.atmel.com/avr. 3.2 Code Examples This documentation 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 vendors include bit definitions in the header files and interrupt handling in C is compiler dependent. Please confirm with the C compiler documentation for more details. For I/O Registers located in the extended I/O map, "IN", "OUT", "SBIS", "SBIC", "CBI", and "SBI" instructions must be replaced with instructions that allow access to extended I/O. Typically, this means "LDS" and "STS" combined with "SBRS", "SBRC", "SBR", and "CBR". Note that not all AVR devices include an extended I/O map. 3.3 Data Retention Reliability Qualification results show that the projected data retention failure rate is much less than 1 PPM over 20 years at 85C or 100 years at 25C. 3.4 Disclaimer Typical values contained in this datasheet are based on simulations and characterization of other AVR microcontrollers manufactured on the same process technology. 6 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 4. CPU Core This section discusses the AVR core architecture in general. The main function of the CPU core is to ensure correct program execution. The CPU must therefore be able to access memories, perform calculations, control peripherals, and handle interrupts. 4.1 Architectural Overview Figure 4-1. Block Diagram of the AVR Architecture Data Bus 8-bit Flash Program Memory Program Counter Status and Control 32 x 8 General Purpose Registrers Control Lines Direct Addressing Instruction Decoder Indirect Addressing Instruction Register Interrupt Unit Watchdog Timer ALU Analog Comparator Timer/Counter 0 Data SRAM Timer/Counter 1 Universal Serial Interface EEPROM I/O Lines In order to maximize performance and parallelism, the AVR uses a Harvard architecture - with separate memories and buses for program and data. Instructions in the Program memory are executed with a single level 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 Reprogrammable Flash memory. 7 8006K-AVR-10/10 The fast-access Register File contains 32 x 8-bit general purpose working registers with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU) operation. In a typical ALU operation, 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 three 16-bit indirect address register pointers for Data Space addressing - enabling efficient address calculations. One of the these address pointers can also be used as an address pointer for look up tables in Flash Program memory. These added function registers are the 16-bit X-, Y-, and Z-register, described later in this section. The ALU supports arithmetic and logic operations between registers or between a constant and a register. Single register operations can also be executed in the ALU. After an arithmetic operation, the Status Register is updated to reflect information about the result of the operation. Program flow is provided by conditional and unconditional jump and call instructions, capable of directly addressing the whole address space. Most AVR instructions have a single 16-bit word format but 32-bit wide instructions also exist. The actual instruction set varies, as some devices only implement a part of the instruction set. 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 Stack Pointer (SP) is read/write accessible in the I/O space. The data SRAM can easily be 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. 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 interrupts have a separate Interrupt Vector in the Interrupt Vector table. The interrupts have priority in accordance with their Interrupt Vector position. The lower the Interrupt Vector address, the higher the priority. The I/O memory space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, 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, 0x20 - 0x5F. 4.2 ALU - Arithmetic Logic Unit The high-performance AVR ALU operates in direct connection with all the 32 general purpose working registers. Within a single clock cycle, arithmetic operations between general purpose registers or between a register and an immediate are executed. The ALU operations are divided into three main categories - arithmetic, logical, and bit-functions. Some implementations of the architecture also provide a powerful multiplier supporting both signed/unsigned multiplication and fractional format. See the "Instruction Set" section for a detailed description. 4.3 Status Register The Status Register contains information about the result of the most recently executed arithmetic instruction. This information can be used for altering program flow in order to perform conditional operations. Note that the Status Register is updated after all ALU operations, as specified in the Instruction Set Reference. This will in many cases remove the need for using the dedicated compare instructions, resulting in faster and more compact code. 8 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 The Status Register is neither automatically stored when entering an interrupt routine, nor restored when returning from an interrupt. This must be handled by software. 4.3.1 SREG - AVR Status Register Bit 7 6 5 4 3 2 1 0 0x3F (0x5F) I T H S V N Z C Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 SREG * Bit 7 - I: Global Interrupt Enable The Global Interrupt Enable bit must be set for the interrupts to be enabled. The individual interrupt enable control is then performed in separate control registers. If the Global Interrupt Enable Register is cleared, none of the interrupts are enabled independent of the individual interrupt enable settings. The I-bit is cleared by hardware after an interrupt 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 Copy Storage The Bit Copy instructions BLD (Bit LoaD) and BST (Bit STore) use the T-bit as source or destination for the operated bit. A bit from a register in the Register File can be copied into T by the BST instruction, and a bit in T can be copied into a bit in a register 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. Half Carry is useful in BCD arithmetic. See the "Instruction Set Description" for detailed information. * 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 Complement Overflow Flag V. See the "Instruction 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" for detailed information. * Bit 2 - N: Negative Flag The Negative Flag N indicates a negative result in an arithmetic or logic operation. See the "Instruction Set Description" for detailed information. * Bit 1 - Z: Zero Flag The Zero Flag Z indicates a zero result in an arithmetic or logic operation. See the "Instruction Set Description" for 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 detailed information. 9 8006K-AVR-10/10 4.4 General Purpose Register File The Register File is optimized for the AVR Enhanced RISC instruction set. In order to achieve the required performance and flexibility, the following input/output schemes are supported by the Register File: * One 8-bit output operand and one 8-bit result input * Two 8-bit output operands and one 8-bit result input * Two 8-bit output operands and one 16-bit result input * One 16-bit output operand and one 16-bit result input Figure 4-2 below shows the structure of the 32 general purpose working registers in the CPU. Figure 4-2. AVR CPU General Purpose Working Registers 7 0 Addr. R0 0x00 R1 0x01 R2 0x02 ... R13 0x0D General R14 0x0E Purpose R15 0x0F Working R16 0x10 Registers R17 0x11 ... R26 0x1A X-register Low Byte R27 0x1B X-register High Byte R28 0x1C Y-register Low Byte R29 0x1D Y-register High Byte R30 0x1E Z-register Low Byte R31 0x1F Z-register High Byte Most of the instructions operating on the Register File have direct access to all registers, and most of them are single cycle instructions. As shown in Figure 4-2, 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 great flexibility in access of the registers, as the X-, Y- and Z-pointer registers can be set to index any register in the file. 4.4.1 10 The X-register, Y-register, and Z-register The registers R26..R31 have some added functions to their general purpose usage. These registers are 16-bit address pointers for indirect addressing of the data space. The three indirect address registers X, Y, and Z are defined as described in Figure 4-3 below. ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 4-3. The X-, Y-, and Z-registers 15 XH XL 7 X-register 0 R27 (0x1B) YH YL 7 0 R29 (0x1D) Z-register 0 R26 (0x1A) 15 Y-register 0 7 0 7 0 R28 (0x1C) 15 ZH 7 0 ZL 7 R31 (0x1F) 0 0 R30 (0x1E) In the different addressing modes these address registers have functions as fixed displacement, automatic increment, and automatic decrement (see the instruction set reference for details). 4.5 Stack Pointer The Stack is mainly used for storing temporary data, for storing local variables and for storing return addresses after interrupts and subroutine calls. The Stack Pointer Register always points to the top of the Stack. Note that the Stack is implemented as growing from higher memory locations to lower memory locations. This implies that a Stack PUSH command decreases the Stack Pointer. The Stack Pointer points to the data SRAM Stack area where the Subroutine and Interrupt Stacks are located. This Stack space 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 0x60. The Stack Pointer is decremented by one when data is pushed onto the Stack with the PUSH instruction, and it is decremented by two when the return address is pushed onto the Stack with subroutine call or interrupt. 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 data is popped from the Stack with return from subroutine RET or return from interrupt RETI. The AVR Stack Pointer is implemented as two 8-bit registers in the I/O space. The number of bits actually used is implementation dependent. Note that the data space in some implementations of the AVR architecture is so small that only SPL is needed. In this case, the SPH Register will not be present. 4.5.1 SPH and SPL -- Stack Pointer Register Bit 15 14 13 12 11 10 9 8 0x3E (0x5E) SP15 SP14 SP13 SP12 SP11 SP10 SP9 SP8 SPH 0x3D (0x5D) SP7 SP6 SP5 SP4 SP3 SP2 SP1 SP0 SPL 7 6 5 4 3 2 1 0 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND Initial Value RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND RAMEND 11 8006K-AVR-10/10 4.6 Instruction Execution Timing This section describes the general access timing concepts for instruction execution. The AVR CPU is driven by the CPU clock clkCPU, directly generated from the selected clock source for the chip. No internal clock division is used. Figure 4-4 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 corresponding unique results for functions per cost, functions per clocks, and functions per power-unit. Figure 4-4. The Parallel Instruction Fetches and Instruction Executions T1 T2 T3 T4 clkCPU 1st Instruction Fetch 1st Instruction Execute 2nd Instruction Fetch 2nd Instruction Execute 3rd Instruction Fetch 3rd Instruction Execute 4th Instruction Fetch Figure 4-5 shows the internal timing concept for the Register File. In a single clock cycle an ALU operation using two register operands is executed, and the result is stored back to the destination register. Figure 4-5. Single Cycle ALU Operation T1 T2 T3 T4 clkCPU Total Execution Time Register Operands Fetch ALU Operation Execute Result Write Back 4.7 Reset and Interrupt Handling The AVR provides several different interrupt sources. These interrupts and the separate Reset Vector each have a separate Program Vector in the Program memory space. All interrupts are assigned individual enable bits which must be written logic one together with the Global Interrupt Enable bit in the Status Register in order to enable the interrupt. The lowest addresses in the Program memory space are by default defined as the Reset and Interrupt Vectors. The complete list of vectors is shown in "Interrupts" on page 48. The list also determines the priority levels of the different interrupts. The lower the address the higher is the 12 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 priority level. RESET has the highest priority, and next is INT0 - the External Interrupt Request 0. When an interrupt occurs, the Global Interrupt Enable I-bit is cleared and all interrupts are disabled. The user software can write logic one to the I-bit to enable nested interrupts. All enabled interrupts can then interrupt the current interrupt routine. The I-bit is automatically set when a Return from Interrupt instruction - RETI - is executed. There are basically two types of interrupts. The first type is triggered by an event that sets the Interrupt Flag. For these interrupts, the Program Counter is vectored to the actual Interrupt Vector in order to execute the interrupt handling routine, and hardware clears the corresponding Interrupt Flag. Interrupt Flags can also be cleared by writing a logic one to the flag bit position(s) to be cleared. If an interrupt condition occurs while the corresponding interrupt enable bit is cleared, the Interrupt Flag will be set and remembered until the interrupt is enabled, or the flag is cleared by software. Similarly, if one or more interrupt conditions occur while the Global Interrupt Enable bit is cleared, the corresponding Interrupt Flag(s) will be set and remembered until the Global Interrupt Enable bit is set, and will then be executed by order of priority. The second type of interrupts will trigger as long as the interrupt condition is present. These interrupts do not necessarily have Interrupt Flags. If the interrupt condition disappears before the interrupt is enabled, the interrupt will not be triggered. When the AVR exits from an interrupt, it will always return to the main program and execute one more instruction before any pending interrupt is served. Note that the Status Register is not automatically stored when entering an interrupt routine, nor restored when returning from an interrupt routine. This must be handled by software. When using the CLI instruction to disable interrupts, the interrupts will be immediately disabled. No interrupt will be executed after the CLI instruction, even if it occurs simultaneously with the CLI instruction. The following example shows how this can be used to avoid interrupts during the timed EEPROM write sequence. Assembly Code Example in r16, SREG cli ; store SREG value ; disable interrupts during timed sequence sbi EECR, EEMPE ; start EEPROM write sbi EECR, EEPE out SREG, r16 ; restore SREG value (I-bit) C Code Example char cSREG; cSREG = SREG; /* store SREG value */ /* disable interrupts during timed sequence */ _CLI(); EECR |= (1< ... ... ; Set Stack Pointer to top of RAM ; Enable interrupts External Interrupts The External Interrupts are triggered by the INT0 pin or any of the PCINT11:0 pins. Observe that, if enabled, the interrupts will trigger even if the INT0 or PCINT11:0 pins are configured as outputs. This feature provides a way of generating a software interrupt. Pin change 0 interrupts PCI0 will trigger if any enabled PCINT7:0 pin toggles. Pin change 1 interrupts PCI1 will trigger if any enabled PCINT11:8 pin toggles. The PCMSK0 and PCMSK1 Registers control which pins contribute to the pin change interrupts. Pin change interrupts on PCINT11:0 are detected asynchronously. This implies that these interrupts can be used for waking the part also from sleep modes other than Idle mode. The INT0 interrupts can be triggered by a falling or rising edge or a low level. This is set up as indicated in the specification for the MCU Control Register - MCUCR. When the INT0 interrupt is enabled and is configured as level triggered, the interrupt will trigger as long as the pin is held low. Note that recognition of falling or rising edge interrupts on INT0 requires the presence of an I/O clock, as described in "Clock Sources" on page 25. 9.2.1 Low Level Interrupt A low level interrupt on INT0 is detected asynchronously. This means that the interrupt source can be used for waking the part also from sleep modes other than Idle (the I/O clock is halted in all sleep modes except Idle). 49 8006K-AVR-10/10 Note that if a level triggered interrupt is used for wake-up from Power-down, the required level must be held long enough for the MCU to complete the wake-up to trigger the level interrupt. If the level disappears before the end of the Start-up Time, the MCU will still wake up, but no interrupt will be generated. The start-up time is defined by the SUT and CKSEL fuses, as described in "Clock System" on page 24. If the low level on the interrupt pin is removed before the device has woken up then program execution will not be diverted to the interrupt service routine but continue from the instruction following the SLEEP command. 9.2.2 Pin Change Interrupt Timing An example of timing of a pin change interrupt is shown in Figure 9-1. Figure 9-1. Timing of pin change interrupts pin_lat PCINT(0) LE clk D pcint_in_(0) Q pin_sync PCINT(0) in PCMSK(x) 0 pcint_syn pcint_setflag PCIF x clk clk PCINT(0) pin_lat pin_sync pcint_in_(0) pcint_syn pcint_setflag PCIF 50 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 9.3 9.3.1 Register Description MCUCR - MCU Control Register The External Interrupt Control Register A contains control bits for interrupt sense control. Bit 7 6 5 4 3 2 1 0 0x35 (0x55) BODS PUD SE SM1 SM0 BODSE ISC01 ISC00 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 MCUCR * Bits 1:0 - ISC01, ISC00: Interrupt Sense Control 0 Bit 1 and Bit 0 The External Interrupt 0 is activated by the external pin INT0 if the SREG I-flag and the corresponding interrupt mask are set. The level and edges on the external INT0 pin that activate the interrupt are defined in Table 9-2. The value on the INT0 pin is sampled before detecting edges. If edge or toggle interrupt is selected, pulses that last longer than one clock period will generate an interrupt. Shorter pulses are not guaranteed to generate an interrupt. If low level interrupt is selected, the low level must be held until the completion of the currently executing instruction to generate an interrupt. Table 9-2. 9.3.2 Interrupt 0 Sense Control ISC01 ISC00 Description 0 0 The low level of INT0 generates an interrupt request. 0 1 Any logical change on INT0 generates an interrupt request. 1 0 The falling edge of INT0 generates an interrupt request. 1 1 The rising edge of INT0 generates an interrupt request. GIMSK - General Interrupt Mask Register Bit 7 6 5 4 3 2 1 0x3B (0x5B) - INT0 PCIE1 PCIE0 - - - 0 - Read/Write R R/W R/W R/W R R R R Initial Value 0 0 0 0 0 0 0 0 GIMSK * Bits 7, 3:0 - Res: Reserved Bits These bits are reserved in the ATtiny24/44/84 and will always read as zero. * Bit 6 - INT0: External Interrupt Request 0 Enable When the INT0 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), the external pin interrupt is enabled. The Interrupt Sense Control bits (ISC01 and ISC00) in the External Interrupt Control Register A (EICRA) define whether the external interrupt is activated on rising and/or falling edge of the INT0 pin or level sensed. Activity on the pin will cause an interrupt request even if INT0 is configured as an output. The corresponding interrupt of External Interrupt Request 0 is executed from the INT0 Interrupt Vector. * Bit 5 - PCIE1: Pin Change Interrupt Enable 1 When the PCIE1 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), pin change interrupt 1 is enabled. Any change on any enabled PCINT11:8 pin will cause an interrupt. The corresponding interrupt of Pin Change Interrupt Request is executed from the PCI1 Interrupt Vector. PCINT11:8 pins are enabled individually by the PCMSK1 Register. 51 8006K-AVR-10/10 * Bit 4 - PCIE0: Pin Change Interrupt Enable 0 When the PCIE0 bit is set (one) and the I-bit in the Status Register (SREG) is set (one), pin change interrupt 0 is enabled. Any change on any enabled PCINT7:0 pin will cause an interrupt. The corresponding interrupt of Pin Change Interrupt Request is executed from the PCI0 Interrupt Vector. PCINT7:0 pins are enabled individually by the PCMSK0 Register. 9.3.3 GIFR - General Interrupt Flag Register Bit 7 6 5 4 3 2 1 0x3A (0x5A - INTF0 PCIF1 PCIF0 - - - 0 - Read/Write R R/W R/W R/W R R R R Initial Value 0 0 0 0 0 0 0 0 GIFR * Bits 7, 3:0 - Res: Reserved Bits These bits are reserved in the ATtiny24/44/84 and will always read as zero. * Bit 6 - INTF0: External Interrupt Flag 0 When an edge or logic change on the INT0 pin triggers an interrupt request, INTF0 becomes set (one). If the I-bit in SREG and the INT0 bit in GIMSK are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. This flag is always cleared when INT0 is configured as a level interrupt. * Bit 5 - PCIF1: Pin Change Interrupt Flag 1 When a logic change on any PCINT11:8 pin triggers an interrupt request, PCIF1 becomes set (one). If the I-bit in SREG and the PCIE1 bit in GIMSK are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. * Bit 4 - PCIF0: Pin Change Interrupt Flag 0 When a logic change on any PCINT7:0 pin triggers an interrupt request, PCIF becomes set (one). If the I-bit in SREG and the PCIE0 bit in GIMSK are set (one), the MCU will jump to the corresponding Interrupt Vector. The flag is cleared when the interrupt routine is executed. Alternatively, the flag can be cleared by writing a logical one to it. 9.3.4 PCMSK1 - Pin Change Mask Register 1 Bit 7 6 5 4 3 2 1 0 0x20 (0x40) - - - - PCINT11 PCINT10 PCINT9 PCINT8 Read/Write R R R R R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 PCMSK1 * Bits 7:4 - Res: Reserved Bits These bits are reserved in the ATtiny24/44/84 and will always read as zero. * Bits 3:0 - PCINT11:8: Pin Change Enable Mask 11:8 Each PCINT11:8 bit selects whether pin change interrupt is enabled on the corresponding I/O pin. If PCINT11:8 is set and the PCIE1 bit in GIMSK is set, pin change interrupt is enabled on the corresponding I/O pin. If PCINT11:8 is cleared, pin change interrupt on the corresponding I/O pin is disabled. 52 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 9.3.5 PCMSK0 - Pin Change Mask Register 0 Bit 7 6 5 4 3 2 1 0 0x12 (0x32) PCINT7 PCINT6 PCINT5 PCINT4 PCINT3 PCINT2 PCINT1 PCINT0 Read/Write R/W R/W R/W R/W R/W R/W R/W R/W Initial Value 0 0 0 0 0 0 0 0 PCMSK0 * Bits 7:0 - PCINT7:0: Pin Change Enable Mask 7:0 Each PCINT7:0 bit selects whether pin change interrupt is enabled on the corresponding I/O pin. If PCINT7:0 is set and the PCIE0 bit in GIMSK is set, pin change interrupt is enabled on the corresponding I/O pin. If PCINT7:0 is cleared, pin change interrupt on the corresponding I/O pin is disabled. 53 8006K-AVR-10/10 10. I/O Ports All AVR ports have true Read-Modify-Write functionality when used as general digital I/O ports. This means that the direction of one port pin can be changed without unintentionally changing the direction of any other pin with the SBI and CBI instructions. The same applies when changing drive value (if configured as output) or enabling/disabling of pull-up resistors (if configured as input). Each output buffer has symmetrical drive characteristics with both high sink and source capability. The pin driver is strong enough to drive LED displays directly. All port pins have individually selectable pull-up resistors with a supply-voltage invariant resistance. All I/O pins have protection diodes to both VCC and Ground as indicated in Figure 10-1 on page 54. See "Electrical Characteristics" on page 174 for a complete list of parameters. Figure 10-1. I/O Pin Equivalent Schematic Rpu Logic Pxn Cpin See Figure "General Digital I/O" for Details All registers and bit references in this section are written in general form. A lower case "x" represents the numbering letter for the port, and a lower case "n" represents the bit number. However, when using the register or bit defines in a program, the precise form must be used. For example, PORTB3 for bit no. 3 in Port B, here documented generally as PORTxn. The physical I/O Registers and bit locations are listed in "Register Description" on page 67. Three I/O memory address locations are allocated for each port, one each for the Data Register - PORTx, Data Direction Register - DDRx, and the Port Input Pins - PINx. The Port Input Pins I/O location is read only, while the Data Register and the Data Direction Register are read/write. However, writing a logic one to a bit in the PINx Register, will result in a toggle in the corresponding bit in the Data Register. In addition, the Pull-up Disable - PUD bit in MCUCR disables the pull-up function for all pins in all ports when set. Using the I/O port as General Digital I/O is described in "Ports as General Digital I/O" on page 55. Most port pins are multiplexed with alternate functions for the peripheral features on the device. How each alternate function interferes with the port pin is described in "Alternate Port Functions" on page 58. Refer to the individual module sections for a full description of the alternate functions. Note that enabling the alternate function of some of the port pins does not affect the use of the other pins in the port as general digital I/O. 54 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 10.1 Ports as General Digital I/O The ports are bi-directional I/O ports with optional internal pull-ups. Figure 10-2 shows a functional description of one I/O-port pin, here generically called Pxn. Figure 10-2. General Digital I/O(1) PUD Q D DDxn Q CLR WDx RESET DATA BUS RDx 1 Q Pxn D 0 PORTxn Q CLR RESET WRx WPx RRx SLEEP SYNCHRONIZER D Q L Q D RPx Q PINxn Q clk I/O PUD: SLEEP: clkI/O: Note: 10.1.1 PULLUP DISABLE SLEEP CONTROL I/O CLOCK WDx: RDx: WRx: RRx: RPx: WPx: WRITE DDRx READ DDRx WRITE PORTx READ PORTx REGISTER READ PORTx PIN WRITE PINx REGISTER 1. WRx, WPx, WDx, RRx, RPx, and RDx are common to all pins within the same port. clkI/O, SLEEP, and PUD are common to all ports. Configuring the Pin Each port pin consists of three register bits: DDxn, PORTxn, and PINxn. As shown in "Register Description" on page 67, the DDxn bits are accessed at the DDRx I/O address, the PORTxn bits at the PORTx I/O address, and the PINxn bits at the PINx I/O address. The DDxn bit in the DDRx Register selects the direction of this pin. If DDxn is written logic one, Pxn is configured as an output pin. If DDxn is written logic zero, Pxn is configured as an input pin. If PORTxn is written logic one when the pin is configured as an input pin, the pull-up resistor is activated. To switch the pull-up resistor off, PORTxn has to be written logic zero or the pin has to be configured as an output pin. The port pins are tri-stated when reset condition becomes active, even if no clocks are running. If PORTxn is written logic one when the pin is configured as an output pin, the port pin is driven high (one). If PORTxn is written logic zero when the pin is configured as an output pin, the port pin is driven low (zero). 55 8006K-AVR-10/10 10.1.2 Toggling the Pin Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port. 10.1.3 Switching Between Input and Output When switching between tri-state ({DDxn, PORTxn} = 0b00) and output high ({DDxn, PORTxn} = 0b11), an intermediate state with either pull-up enabled {DDxn, PORTxn} = 0b01) or output low ({DDxn, PORTxn} = 0b10) must occur. Normally, the pull-up enabled state is fully acceptable, as a high-impedant environment will not notice the difference between a strong high driver and a pull-up. If this is not the case, the PUD bit in the MCUCR Register can be set to disable all pull-ups in all ports. Switching between input with pull-up and output low generates the same problem. The user must use either the tri-state ({DDxn, PORTxn} = 0b00) or the output high state ({DDxn, PORTxn} = 0b10) as an intermediate step. Table 10-1 summarizes the control signals for the pin value. Table 10-1. 10.1.4 Port Pin Configurations DDxn PORTxn PUD (in MCUCR) I/O Pull-up 0 0 X Input No Tri-state (Hi-Z) 0 1 0 Input Yes Pxn will source current if ext. pulled low 0 1 1 Input No Tri-state (Hi-Z) 1 0 X Output No Output Low (Sink) 1 1 X Output No Output High (Source) Comment Reading the Pin Value Independent of the setting of Data Direction bit DDxn, the port pin can be read through the PINxn Register bit. As shown in Figure 10-2 on page 55, the PINxn Register bit and the preceding latch constitute a synchronizer. This is needed to avoid metastability if the physical pin changes value near the edge of the internal clock, but it also introduces a delay. Figure 10-3 shows a timing diagram of the synchronization when reading an externally applied pin value. The maximum and minimum propagation delays are denoted tpd,max and tpd,min respectively. Figure 10-3. Synchronization when Reading an Externally Applied Pin value SYSTEM CLK INSTRUCTIONS XXX XXX in r17, PINx SYNC LATCH PINxn r17 0x00 0xFF t pd, max t pd, min 56 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Consider the clock period starting shortly after the first falling edge of the system clock. The latch is closed when the clock is low, and goes transparent when the clock is high, as indicated by the shaded region of the "SYNC LATCH" signal. The signal value is latched when the system clock goes low. It is clocked into the PINxn Register at the succeeding positive clock edge. As indicated by the two arrows tpd,max and tpd,min, a single signal transition on the pin will be delayed between 1/2 and 11/2 system clock period depending upon the time of assertion. When reading back a software assigned pin value, a nop instruction must be inserted as indicated in Figure 10-4 on page 57. The out instruction sets the "SYNC LATCH" signal at the positive edge of the clock. In this case, the delay tpd through the synchronizer is one system clock period. Figure 10-4. Synchronization when Reading a Software Assigned Pin Value SYSTEM CLK r16 INSTRUCTIONS 0xFF out PORTx, r16 nop in r17, PINx SYNC LATCH PINxn r17 0x00 0xFF t pd The following code example shows how to set port A pins 0 and 1 high, 2 and 3 low, and define the port pins from 4 to 5 as input with a pull-up assigned to port pin 4. The resulting pin values are read back again, but as previously discussed, a nop instruction is included to be able to read back the value recently assigned to some of the pins. Assembly Code Example ... ; Define pull-ups and set outputs high ; Define directions for port pins ldi r16,(1< 2 CPU clock cycles for fck < 12 MHz, 3 CPU clock cycles for fck >= 12 MHz * High:> 2 CPU clock cycles for fck < 12 MHz, 3 CPU clock cycles for fck >= 12 MHz 19.5.1 Serial Programming Algorithm When writing serial data to the ATtiny24/44/84, data is clocked on the rising edge of SCK. When reading, data is clocked on the falling edge of SCK. See Figure 20-4 and Figure 20-5 for timing details. To program and verify the ATtiny24/44/84 in the Serial Programming mode, the following sequence is recommended (see four byte instruction formats in Table 19-12): 1. Power-up sequence: Apply power between VCC and GND while RESET and SCK are set to "0". In some systems, the programmer can not guarantee that SCK is held low during power-up. In this case, RESET must be given a positive pulse after SCK has been set to '0'. The duration of the pulse must be at least tRST (the minimum pulse width on RESET pin, see Table 20-4 on page 177) plus two CPU clock cycles. 2. Wait for at least 20 ms and enable serial programming by sending the Programming Enable serial instruction to pin MOSI. 3. The serial programming instructions will not work if the communication is out of synchronization. When in sync. the second byte (0x53), will echo back when issuing the third byte of the Programming Enable instruction. Whether the echo is correct or not, all four bytes of the instruction must be transmitted. If the 0x53 did not echo back, give RESET a positive pulse and issue a new Programming Enable command. 4. The Flash is programmed one page at a time. The memory page is loaded one byte at a time by supplying the 5 LSB of the address and data together with the Load Program memory Page instruction. To ensure correct loading of the page, the data low byte must be loaded before data high byte is applied for a given address. The Program memory Page is stored by loading the Write Program memory Page instruction with the 3 MSB of the address. If polling (RDY/BSY) is not used, the user must wait at least tWD_FLASH before issuing the next page. (See Table 19-11 on page 165.) Accessing the serial programming interface before the Flash write operation completes can result in incorrect programming. 5. A: The EEPROM array is programmed one byte at a time by supplying the address and data together with the appropriate Write instruction. An EEPROM memory location is first automatically erased before new data is written. If polling (RDY/BSY) is not used, the user must wait at least tWD_EEPROM before issuing the next byte. (See Table 19-11 on page 165.) In a chip erased device, no 0xFFs in the data file(s) need to be programmed. B: The EEPROM array is programmed one page at a time. The Memory page is loaded one byte at a time by supplying the 2 LSB of the address and data together with the Load EEPROM Memory Page instruction. The EEPROM Memory Page is stored by loading the Write EEPROM Memory Page Instruction with the 4 MSB of the address. When using EEPROM page access only byte locations loaded with the Load EEPROM Memory Page instruction is altered. The remaining locations remain unchanged. If polling (RDY/BSY) is not used, the used must wait at least tWD_EEPROM before issuing the 164 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 next page (See Table 19-11 on page 165). In a chip erased device, no 0xFF in the data file(s) need to be programmed. 6. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO. 7. At the end of the programming session, RESET can be set high to commence normal operation. 8. Power-off sequence (if needed): Set RESET to "1". Turn VCC power off. Table 19-11. Minimum Wait Delay Before Writing the Next Flash or EEPROM Location 19.5.2 Symbol Minimum Wait Delay tWD_FLASH 4.5 ms tWD_EEPROM 4.0 ms tWD_ERASE 9.0 ms tWD_FUSE 4.5 ms Serial Programming Instruction set The instruction set is described in Table 19-12 and Figure 19-2 on page 166. Table 19-12. Serial Programming Instruction Set Instruction Format (1) Byte 1 Byte 2 Byte 3 Byte4 Programming Enable $AC $53 $00 $00 Chip Erase (Program Memory/EEPROM) $AC $80 $00 $00 Poll RDY/BSY $F0 $00 $00 data byte out Load Extended Address byte $4D $00 Extended adr $00 Load Program Memory Page, High byte $48 adr MSB adr LSB high data byte in Load Program Memory Page, Low byte $40 adr MSB adr LSB low data byte in Load EEPROM Memory Page (page access) $C1 $00 adr LSB data byte in Read Program Memory, High byte $28 adr MSB adr LSB high data byte out Read Program Memory, Low byte $20 adr MSB adr LSB low data byte out Read EEPROM Memory $A0 $00 adr LSB data byte out Read Lock bits $58 $00 $00 data byte out Read Signature Byte $30 $00 adr LSB data byte out Read Fuse bits $50 $00 $00 data byte out Read Fuse High bits $58 $08 $00 data byte out Read Extended Fuse Bits $50 $08 $00 data byte out Read Calibration Byte $38 $00 $00 data byte out Instruction/Operation Load Instructions Read Instructions 165 8006K-AVR-10/10 Table 19-12. Serial Programming Instruction Set (Continued) Instruction Format (1) Instruction/Operation Byte 1 Byte 2 Byte 3 Byte4 Write Program Memory Page $4C adr MSB adr LSB $00 Write EEPROM Memory $C0 $00 adr LSB data byte in Write EEPROM Memory Page (page access) $C2 $00 adr LSB $00 Write Lock bits $AC $E0 $00 data byte in Write Fuse bits $AC $A0 $00 data byte in Write Fuse High bits $AC $A8 $00 data byte in Write Extended Fuse Bits $AC $A4 $00 data byte in Write Instructions Notes: (6) 1. Not all instructions are applicable for all parts. 2. a = address 3. Bits are programmed `0', unprogrammed `1'. 4. To ensure future compatibility, unused Fuses and Lock bits should be unprogrammed (`1') . 5. Refer to the correspondig section for Fuse and Lock bits, Calibration and Signature bytes and Page size. 6. Instructions accessing program memory use a word address. This address may be random within the page range. 7. See http://www.atmel.com/avr for Application Notes regarding programming and programmers. Figure 19-2. Serial Programming Instruction example Serial Programming Instruction Load Program Memory Page (High/Low Byte)/ Load EEPROM Memory Page (page access) Byte 1 Byte 2 Adr MSB A Byte 3 Write Program Memory Page/ Write EEPROM Memory Page Byte 1 Byte 4 Byte 2 Adr LSB Bit 15 B Adr MSB Bit 15 B 0 Byte 3 Byte 4 Adrr LSB B 0 Page Buffer Page Offset Page 0 Page 1 Page 2 Page Number Page N-1 Program Memory/ EEPROM Memory 166 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 If the LSB in RDY/BSY data byte out is `1', a programming operation is still pending. Wait until this bit returns `0' before the next instruction is carried out. Within the same page, the low data byte must be loaded prior to the high data byte. After data is loaded to the page buffer, program the EEPROM page, see Figure 19-2 on page 166. 19.6 High-voltage Serial Programming This section describes how to program and verify Flash Program memory, EEPROM Data memory, Lock bits and Fuse bits in the ATtiny24/44/84. Figure 19-3. High-voltage Serial Programming +11.5 - 12.5V SCI +4.5 - 5.5V PB3 (RESET) VCC PB0 PA4 SDO PA2:0 PA5 SII GND PA6 SDI Table 19-13. Pin Name Mapping Signal Name in High-voltage Serial Programming Mode Pin Name SDI PA6 I Serial Data Input SII PA5 I Serial Instruction Input SDO PA4 O Serial Data Output SCI PB0 I Serial Clock Input (min. 220ns period) I/O Function The minimum period for the Serial Clock Input (SCI) during High-voltage Serial Programming is 220 ns. Table 19-14. Pin Values Used to Enter Programming Mode Pin Symbol Value PA0 Prog_enable[0] 0 PA1 Prog_enable[1] 0 PA2 Prog_enable[2] 0 167 8006K-AVR-10/10 19.7 High-Voltage Serial Programming Algorithm To program and verify the ATtiny24/44/84 in the High-voltage Serial Programming mode, the following sequence is recommended (See instruction formats in Table 19-16 on page 171): 19.7.1 Enter High-voltage Serial Programming Mode The following algorithm puts the device in High-voltage Serial Programming mode: 1. Set Prog_enable pins listed in Table 19-14 on page 167 to "000", RESET pin and VCC to 0V. 2. Apply 4.5 - 5.5V between VCC and GND. Ensure that VCC reaches at least 1.8V within the next 20 s. 3. Wait 20 - 60 s, and apply 11.5 - 12.5V to RESET. 4. Keep the Prog_enable pins unchanged for at least 10 s after the High-voltage has been applied to ensure the Prog_enable Signature has been latched. 5. Release the Prog_enable[2] pin after tHVRST has elapsed. 6. Wait at least 300 s before giving any serial instructions on SDI/SII. 7. Exit Programming mode by power the device down or by bringing RESET pin to 0V. If the rise time of the VCC is unable to fulfill the requirements listed above, the following alternative algorithm can be used: 1. Set Prog_enable pins listed in Table 19-14 on page 167 to "000", RESET pin and VCC to 0V. 2. Apply 4.5 - 5.5V between VCC and GND. 3. Monitor VCC, and as soon as VCC reaches 0.9 - 1.1V, apply 11.5 - 12.5V to RESET. 4. Keep the Prog_enable pins unchanged for at least 10 s after the High-voltage has been applied to ensure the Prog_enable Signature has been latched. 5. Release the Prog_enable[2] pin to avoid drive contention on the Prog_enable[2]/SDO pin. 6. Wait until VCC actually reaches 4.5 - 5.5V before giving any serial instructions on SDI/SII. 7. Exit Programming mode by power the device down or by bringing RESET pin to 0V. Table 19-15. High-voltage Reset Characteristics RESET Pin High-voltage Threshold Minimum High-voltage Period for Latching Prog_enable VCC VHVRST tHVRST 4.5V 11.5V 100 ns 5.5V 11.5V 100 ns Supply Voltage 168 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 19.7.2 Considerations for Efficient Programming The loaded command and address are retained in the device during programming. For efficient programming, the following should be considered. * The command needs only be loaded once when writing or reading multiple memory locations. * Skip writing the data value 0xFF that is the contents of the entire EEPROM (unless the EESAVE Fuse is programmed) and Flash after a Chip Erase. * Address High byte needs only be loaded before programming or reading a new 256 word window in Flash or 256 byte EEPROM. This consideration also applies to Signature bytes reading. 19.7.3 Chip Erase The Chip Erase will erase the Flash and EEPROM(1) memories plus Lock bits. The Lock bits are not reset until the Program memory has been completely erased. The Fuse bits are not changed. A Chip Erase must be performed before the Flash and/or EEPROM are reprogrammed. 1. Load command "Chip Erase" (see Table 19-16 on page 171). 2. Wait after Instr. 3 until SDO goes high for the "Chip Erase" cycle to finish. 3. Load Command "No Operation". Note: 19.7.4 1. The EEPROM memory is preserved during Chip Erase if the EESAVE Fuse is programmed. Programming the Flash The Flash is organized in pages, see "Page Size" on page 162. When programming the Flash, the program data is latched into a page buffer. This allows one page of program data to be programmed simultaneously. The following procedure describes how to program the entire Flash memory: 1. Load Command "Write Flash" (see Table 19-16 on page 171). 2. Load Flash Page Buffer. 3. Load Flash High Address and Program Page. Wait after Instr. 3 until SDO goes high for the "Page Programming" cycle to finish. 4. Repeat 2 through 3 until the entire Flash is programmed or until all data has been programmed. 5. End Page Programming by Loading Command "No Operation". When writing or reading serial data to the ATtiny24/44/84, data is clocked on the rising edge of the serial clock, see Figure 20-6 on page 184, Figure 19-3 on page 167 and Table 20-13 on page 184 for details. 169 8006K-AVR-10/10 Figure 19-4. Addressing the Flash which is Organized in Pages PCMSB PROGRAM COUNTER PAGEMSB PCPAGE PCWORD PAGE ADDRESS WITHIN THE FLASH WORD ADDRESS WITHIN A PAGE PROGRAM MEMORY PAGE PAGE PCWORD[PAGEMSB:0]: 00 INSTRUCTION WORD 01 02 PAGEEND Figure 19-5. High-voltage Serial Programming Waveforms SDI PB0 MSB LSB SII PB1 MSB LSB SDO PB2 SCI PB3 19.7.5 MSB 0 LSB 1 2 3 4 5 6 7 8 9 10 Programming the EEPROM The EEPROM is organized in pages, see Table 20-12 on page 183. When programming the EEPROM, the data is latched into a page buffer. This allows one page of data to be programmed simultaneously. The programming algorithm for the EEPROM Data memory is as follows (refer to Table 19-16 on page 171): 1. Load Command "Write EEPROM". 2. Load EEPROM Page Buffer. 3. Program EEPROM Page. Wait after Instr. 2 until SDO goes high for the "Page Programming" cycle to finish. 4. Repeat 2 through 3 until the entire EEPROM is programmed or until all data has been programmed. 5. End Page Programming by Loading Command "No Operation". 170 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 19.7.6 Reading the Flash The algorithm for reading the Flash memory is as follows (refer to Table 19-16 on page 171): 1. Load Command "Read Flash". 2. Read Flash Low and High Bytes. The contents at the selected address are available at serial output SDO. 19.7.7 Reading the EEPROM The algorithm for reading the EEPROM memory is as follows (refer to Table 19-16 on page 171): 1. Load Command "Read EEPROM". 2. Read EEPROM Byte. The contents at the selected address are available at serial output SDO. 19.7.8 Programming and Reading the Fuse and Lock Bits The algorithms for programming and reading the Fuse Low/High bits and Lock bits are shown in Table 19-16 on page 171. 19.7.9 Reading the Signature Bytes and Calibration Byte The algorithms for reading the Signature bytes and Calibration byte are shown in Table 19-16 on page 171. 19.7.10 Power-off sequence Set SCI to "0". Set RESET to "1". Turn VCC power off. Table 19-16. High-voltage Serial Programming Instruction Set for ATtiny24/44/84 Instruction Format Instruction Chip Erase Load "Write Flash" Command Load Flash Page Buffer Load Flash High Address and Program Page Instr.1/5 Instr.2/6 Instr.3/7 Instr.4 SDI 0_1000_0000_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_0001_0000_00 SII 0_0100_1100_00 SDO x_xxxx_xxxx_xx SDI 0_ bbbb_bbbb _00 0_eeee_eeee_00 0_0000_0000_00 0_0000_0000_00 SII 0_0000_1100_00 0_0010_1100_00 0_0110_1101_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_dddd_dddd_00 0_0000_0000_00 0_0000_0000_00 SII 0_0011_1100_00 0_0111_1101_00 0_0111_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx Operation Remarks Wait after Instr.3 until SDO goes high for the Chip Erase cycle to finish. Enter Flash Programming code. SDI 0_0000_000a_00 0_0000_0000_00 0_0000_0000_00 SII 0_0001_1100_00 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx Repeat after Instr. 1 - 7until the entire page buffer is filled or until all data within the page is filled.(2) Instr 5-7. Wait after Instr 3 until SDO goes high. Repeat Instr. 2 - 3 for each loaded Flash Page until the entire Flash or all data is programmed. Repeat Instr. 1 for a new 256 byte page.(2) 171 8006K-AVR-10/10 Table 19-16. High-voltage Serial Programming Instruction Set for ATtiny24/44/84 (Continued) Instruction Format Instruction Instr.1/5 Instr.2/6 Instr.3/7 Instr.4 SDI 0_0000_0010_00 SII 0_0100_1100_00 SDO x_xxxx_xxxx_xx SDI 0_bbbb_bbbb_00 0_0000_000a_00 0_0000_0000_00 0_0000_0000_00 SII 0_0000_1100_00 0_0001_1100_00 0_0110_1000_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx q_qqqq_qqqx_xx SDI 0_0000_0000_00 0_0000_0000_00 SII 0_0111_1000_00 0_0111_1100_00 SDO x_xxxx_xxxx_xx p_pppp_pppx_xx SDI 0_0001_0001_00 SII 0_0100_1100_00 SDO x_xxxx_xxxx_xx SDI 0_bbbb_bbbb_00 0_aaaa_aaaa_00 SII 0_0000_1100_00 0_0001_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_0000_0000_00 SII 0_0110_1100_00 SDO x_xxxx_xxxx_xx SDI 0_0000_0000_00 0_0000_0000_00 SII 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_bbbb_bbbb_00 0_aaaa_aaaa_00 0_eeee_eeee_00 0_0000_0000_00 SII 0_0000_1100_00 0_0001_1100_00 0_0010_1100_00 0_0110_1101_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_0000_0000_00 0_0000_0000_00 SII 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx Load "Read EEPROM" Command SDI 0_0000_0011_00 SII 0_0100_1100_00 SDO x_xxxx_xxxx_xx Read EEPROM Byte SDI 0_bbbb_bbbb_00 0_aaaa_aaaa_00 0_0000_0000_00 0_0000_0000_00 SII 0_0000_1100_00 0_0001_1100_00 0_0110_1000_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx q_qqqq_qqq0_00 SDI 0_0100_0000_00 0_A987_6543_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0010_1100_00 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_0100_0000_00 0_IHGF_EDCB_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0010_1100_00 0_0111_0100_00 0_0111_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx Load "Read Flash" Command Read Flash Low and High Bytes Load "Write EEPROM" Command Load EEPROM Page Buffer Program EEPROM Page Write EEPROM Byte Write Fuse Low Bits Write Fuse High Bits Write Fuse Extended Bits 172 Enter Flash Read mode. Repeat Instr. 1, 3 - 6 for each new address. Repeat Instr. 2 for a new 256 byte page. Instr 5 - 6. Enter EEPROM Programming mode. 0_eeee_eeee_00 0_0010_1100_00 x_xxxx_xxxx_xx 0_0000_0000_00 0_0110_1101_00 x_xxxx_xxxx_xx Repeat Instr. 1 - 5 until the entire page buffer is filled or until all data within the page is filled.(3) Wait after Instr. 2 until SDO goes high. Repeat Instr. 1 - 2 for each loaded EEPROM page until the entire EEPROM or all data is programmed. Repeat Instr. 1 - 6 for each new address. Wait after Instr. 6 until SDO goes high.(4) Instr. 5-6 Enter EEPROM Read mode. SDI 0_0100_0000_00 0_0000_000J_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0010_1100_00 0_0110_0110_00 0_0110_1110_00 x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDO Operation Remarks Repeat Instr. 1, 3 - 4 for each new address. Repeat Instr. 2 for a new 256 byte page. Wait after Instr. 4 until SDO goes high. Write A - 3 = "0" to program the Fuse bit. Wait after Instr. 4 until SDO goes high. Write F - B = "0" to program the Fuse bit. Wait after Instr. 4 until SDO goes high. Write J = "0" to program the Fuse bit. ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Table 19-16. High-voltage Serial Programming Instruction Set for ATtiny24/44/84 (Continued) Instruction Format Instruction Write Lock Bits Read Fuse Low Bits Read Fuse High Bits Instr.1/5 Instr.2/6 Instr.3/7 Instr.4 SDI 0_0010_0000_00 0_0000_0021_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0010_1100_00 0_0110_0100_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx SDI 0_0000_0100_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0110_1000_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx A_9876_543x_xx SDI 0_0000_0100_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0111_1010_00 0_0111_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx I_HGFE_DCBx_xx Reading F - B = "0" means the Fuse bit is programmed. 0_0000_0100_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0110_1010_00 0_0110_1110_00 x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxJx_xx SDI 0_0000_0100_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0111_1000_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_x21x_xx Read Signature Bytes SDI 0_0000_1000_00 0_0000_00bb_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0000_1100_00 0_0110_1000_00 0_0110_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx q_qqqq_qqqx_xx Read Calibration Byte SDI 0_0000_1000_00 0_0000_0000_00 0_0000_0000_00 0_0000_0000_00 SII 0_0100_1100_00 0_0000_1100_00 0_0111_1000_00 0_0111_1100_00 SDO x_xxxx_xxxx_xx x_xxxx_xxxx_xx x_xxxx_xxxx_xx p_pppp_pppx_xx Load "No Operation" Command SDI 0_0000_0000_00 SII 0_0100_1100_00 SDO x_xxxx_xxxx_xx Read Lock Bits Notes: SDO Wait after Instr. 4 until SDO goes high. Write 2 - 1 = "0" to program the Lock Bit. Reading A - 3 = "0" means the Fuse bit is programmed. SDI Read Fuse Extended Bits Operation Remarks Reading J = "0" means the Fuse bit is programmed. Reading 2, 1 = "0" means the Lock bit is programmed. Repeats Instr 2 4 for each signature byte address. 1. a = address high bits, b = address low bits, d = data in high bits, e = data in low bits, p = data out high bits, q = data out low bits, x = don't care, 1 = Lock Bit1, 2 = Lock Bit2, 3 = CKSEL0 Fuse, 4 = CKSEL1 Fuse, 5 = CKSEL2 Fuse, 6 = CKSEL3 Fuse, 7 = SUT0 Fuse, 8 = SUT1 Fuse, 9 = CKOUT Fuse, A = CKDIV8 Fuse, B = BODLEVEL0 Fuse, C = BODLEVEL1 Fuse, D= BODLEVEL2 Fuse, E = EESAVE Fuse, F = WDTON Fuse, G = SPIEN Fuse, H = DWEN Fuse, I = RSTDISBL Fuse, J = SELFPRGEN 2. For page sizes less than 256 words, parts of the address (bbbb_bbbb) will be parts of the page address. 3. For page sizes less than 256 bytes, parts of the address (bbbb_bbbb) will be parts of the page address. 4. The EEPROM is written page-wise. But only the bytes that are loaded into the page are actually written to the EEPROM. Page-wise EEPROM access is more efficient when multiple bytes are to be written to the same page. Note that auto-erase of EEPROM is not available in High-voltage Serial Programming, only in SPI Programming. 173 8006K-AVR-10/10 20. Electrical Characteristics 20.1 Absolute Maximum Ratings* Operating Temperature.................................. -55C to +125C *NOTICE: Storage Temperature ..................................... -65C to +150C Voltage on any Pin except RESET with respect to Ground ................................-0.5V to VCC+0.5V Voltage on RESET with respect to Ground......-0.5V to +13.0V Stresses beyond those listed under "Absolute Maximum Ratings" may cause permanent damage to the device. This is a stress rating only and functional operation of the device at these or other conditions beyond those indicated in the operational sections of this specification is not implied. Exposure to absolute maximum rating conditions for extended periods may affect device reliability. Maximum Operating Voltage ............................................ 6.0V DC Current per I/O Pin ............................................... 40.0 mA DC Current VCC and GND Pins ................................ 200.0 mA 20.2 DC Characteristics Table 20-1. Symbol DC Characteristics. TA = -40C to +85C Parameter Condition Min Typ (1) Max Units (3) VIL Input Low Voltage VCC = 1.8 - 2.4V VCC = 2.4 - 5.5V -0.5 0.2VCC 0.3VCC(3) V VIH Input High-voltage Except RESET pin VCC = 1.8 - 2.4V VCC = 2.4 - 5.5V 0.7VCC(2) 0.6VCC(2) VCC +0.5 V VIH1 Input High-voltage RESET pin VCC = 1.8V to 5.5V 0.9VCC(2) VCC +0.5 V VOL Output Low Voltage (4) Except RESET pin (6) IOL = 10 mA, VCC = 5V IOL = 5 mA, VCC = 3V 0.6 0.5 V V VOH Output High-voltage (5) Except RESET pin (6) IOH = -10 mA, VCC = 5V IOH = -5 mA, VCC = 3V ILIL Input Leakage Current I/O Pin VCC = 5.5V, pin low (absolute value) < 0.05 1 A ILIH Input Leakage Current I/O Pin VCC = 5.5V, pin high (absolute value) < 0.05 1 A RRST Reset Pull-up Resistor VCC = 5.5V, input low 30 60 k RPU I/O Pin Pull-up Resistor VCC = 5.5V, input low 20 50 k 174 4.3 2.5 V V ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Table 20-1. Symbol DC Characteristics. TA = -40C to +85C (Continued) Parameter Power Supply Current (7) ICC Power-down mode (8) Notes: Typ (1) Max Units Active 1MHz, VCC = 2V 0.33 0.8 mA Active 4MHz, VCC = 3V 1.6 2.5 mA Active 8MHz, VCC = 5V 5 9 mA Idle 1MHz, VCC = 2V 0.11 0.4 mA Idle 4MHz, VCC = 3V 0.4 1.0 mA Idle 8MHz, VCC = 5V 1.5 3.5 mA WDT enabled, VCC = 3V 4.5 10 A WDT disabled, VCC = 3V 0.15 2 A Condition Min 1. Typical values at +25C. 2. "Min" means the lowest value where the pin is guaranteed to be read as high. 3. "Max" means the highest value where the pin is guaranteed to be read as low. 4. Although each I/O port can sink more than the test conditions (10 mA at VCC = 5V, 5 mA at VCC = 3V) under steady state conditions (non-transient), the sum of all IOL (for all ports) should not exceed 60 mA. If IOL exceeds the test conditions, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition. 5. Although each I/O port can source more than the test conditions (10 mA at VCC = 5V, 5 mA at VCC = 3V) under steady state conditions (non-transient), the sum of all IOH (for all ports) should not exceed 60 mA. If IOH exceeds the test condition, VOH may exceed the related specification. Pins are not guaranteed to source current greater than the listed test condition. 6. The RESET pin must tolerate high voltages when entering and operating in programming modes and, as a consequence, has a weak drive strength as compared to regular I/O pins. See Figure 21-24, Figure 21-25, Figure 21-26, and Figure 21-27 (starting on page 198). 7. Values are with external clock using methods described in "Minimizing Power Consumption" on page 35. Power Reduction is enabled (PRR = 0xFF) and there is no I/O drive. 8. BOD Disabled. 20.3 Speed The maximum operating frequency of the device depends on VCC. As shown in Figure 20-1 and Figure 20-2, the maximum frequency vs. VCC relationship is linear between 1.8V < VCC < 2.7V and between 2.7V < VCC < 4.5V. Figure 20-1. Maximum Frequency vs. VCC (ATtiny24V/44V/84V) 10 MHz Safe Operating Area 4 MHz 1.8V 2.7V 5.5V 175 8006K-AVR-10/10 Figure 20-2. Maximum Frequency vs. VCC (ATtiny24/44/84) 20 MHz 10 MHz Safe Operating Area 2.7V 20.4 20.4.1 4.5V 5.5V Clock Characteristics Accuracy of Calibrated Internal RC Oscillator It is possible to manually calibrate the internal oscillator to be more accurate than default factory calibration. Note that the oscillator frequency depends on temperature and voltage. Voltage and temperature characteristics can be found in Figure 21-40 on page 206 and Figure 21-41 on page 206. Table 20-2. Calibration Method Factory Calibration User Calibration Calibration Accuracy of Internal RC Oscillator Target Frequency VCC Temperature Accuracy at given voltage & temperature(1) 8.0 MHz 3V 25C 10% Fixed frequency within: 7.3 - 8.1 MHz Fixed voltage within: 1.8 - 5.5V(2) 2.7 - 5.5V(3) Fixed temperature within: -40C to +85C 1% Notes: 1. Accuracy of oscillator frequency at calibration point (fixed temperature and fixed voltage). 2. Voltage range for ATtiny24V/44V/84V. 3. Voltage range for ATtiny24/44/84. 176 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 20.4.2 External Clock Drive Figure 20-3. External Clock Drive Waveform V IH1 V IL1 Table 20-3. External Clock Drive Characteristics VCC = 1.8 - 5.5V VCC = 2.7 - 5.5V VCC = 4.5 - 5.5V Symbol Parameter 1/tCLCL Clock Frequency tCLCL Clock Period 250 100 50 ns tCHCX High Time 100 40 20 ns tCLCX Low Time 100 40 20 ns tCLCH Rise Time 2.0 1.6 0.5 s tCHCL Fall Time 2.0 1.6 0.5 s tCLCL Change in period from one clock cycle to the next 2 2 2 % 20.5 Min. Max. Min. Max. Min. Max. Units 0 4 0 10 0 20 MHz System and Reset Characteristics Table 20-4. Symbol Reset, Brown-out, and Internal Voltage Characteristics Parameter VRST RESET Pin Threshold Voltage tRST Minimum pulse width on RESET Pin VHYST Condition Min(1) Typ(1) 0.2 VCC Max(1) Units 0.9VCC V 2000 700 400 ns Brown-out Detector Hysteresis 50 mV tBOD Min Pulse Width on Brown-out Reset 2 s VBG Internal bandgap reference voltage VCC = 5V TA = 25C tBG Internal bandgap reference start-up time IBG Internal bandgap reference current consumption Note: VCC = 1.8V VCC = 3V VCC = 5V 1.0 1.1 1.2 V VCC = 5V TA = 25C 40 70 s VCC = 5V TA = 25C 15 A 1. Values are guidelines only. 177 8006K-AVR-10/10 Two versions of power-on reset have been implemented, as follows. 20.5.1 Standard Power-On Reset This implementation of power-on reset existed in early versions of ATtiny24/44/84. The table below describes the characteristics of this power-on reset and it is valid for the following devices, only: * ATtiny24, revision D, and older * ATtiny44, revision C, and older * ATtiny84, revision A Note: Revisions are marked on the package (packages 14P3 and 14S1: bottom, package 20M1: top) Table 20-5. Symbol Characteristics of Standard Power-On Reset. TA = -40 to +85C Parameter Release threshold of power-on reset (2) VPOR VPOA Activation threshold of power-on reset SRON Power-on slope rate Notes: (3) Min(1) Typ(1) Max(1) Units 0.7 1.0 1.4 V 0.05 0.9 1.3 V 4.5 V/ms 0.01 1. Values are guidelines only. 2. Threshold where device is released from reset when voltage is rising. 3. The power-on reset will not work unless the supply voltage has been below VPOA. 20.5.2 Enhanced Power-On Reset This implementation of power-on reset exists in newer versions of ATtiny24/44/84. The table below describes the characteristics of this power-on reset and it is valid for the following devices, only: * ATtiny24, revision E, and newer * ATtiny44, revision D, and newer * ATtiny84, revision B, and newer Table 20-6. Symbol Characteristics of Enhanced Power-On Reset. TA = -40 to +85C Parameter Release threshold of power-on reset VPOR (2) VPOA Activation threshold of power-on reset SRON Power-On Slope Rate Notes: (3) Min(1) Typ(1) Max(1) Units 1.1 1.4 1.6 V 0.6 1.3 1.6 V 0.01 V/ms 1. Values are guidelines only. 2. Threshold where device is released from reset when voltage is rising. 3. The Power-on Reset will not work unless the supply voltage has been below VPOA. 178 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 20.5.3 Brown-Out Detection Table 20-7. VBOT vs. BODLEVEL Fuse Coding BODLEVEL[2:0] Fuses Min(1) 111 20.6 Max(1) 110 1.7 1.8 2.0 101 2.5 2.7 2.9 100 4.1 4.3 4.5 Reserved 1. VBOT may be below nominal minimum operating voltage for some devices. For devices where this is the case, the device is tested down to VCC = VBOT during the production test. This guarantees that a Brown-out Reset will occur before VCC drops to a voltage where correct operation of the microcontroller is no longer guaranteed. Analog Comparator Characteristics, TA = -40C to +85C Symbol Parameter Condition VAIO Input Offset Voltage VCC = 5V, VIN = VCC / 2 ILAC Input Leakage Current VCC = 5V, VIN = VCC / 2 Analog Propagation Delay (from saturation to slight overdrive) VCC = 2.7V 750 VCC = 4.0V 500 Analog Propagation Delay (large step change) VCC = 2.7V 100 VCC = 4.0V 75 Digital Propagation Delay VCC = 1.8 - 5.5V 1 tAPD Note: V Analog Comparator Characteristics Table 20-8. tDPD Units BOD Disabled 0XX Note: Typ(1) Min Typ Max Units < 10 40 mV 50 nA -50 ns 2 CLK All parameters are based on simulation results. 179 8006K-AVR-10/10 20.7 ADC Characteristics Table 20-9. Symbol ADC Characteristics, Single Ended Channels. T = -40C to +85C Parameter Condition Min(1) Typ(1) Resolution Units 10 Bits VREF = 4V, VCC = 4V, ADC clock = 200 kHz 2.0 LSB VREF = 4V, VCC = 4V, ADC clock = 1 MHz 2.5 LSB VREF = 4V, VCC = 4V, ADC clock = 200 kHz Noise Reduction Mode 1.5 LSB VREF = 4V, VCC = 4V, ADC clock = 1 MHz Noise Reduction Mode 2.0 LSB Integral Non-Linearity (INL) (Accuracy after Offset and Gain Calibration) VREF = 4V, VCC = 4V, ADC clock = 200 kHz 1.0 LSB Differential Non-linearity (DNL) VREF = 4V, VCC = 4V, ADC clock = 200 kHz 0.5 LSB Gain Error VREF = 4V, VCC = 4V, ADC clock = 200 kHz 2.0 LSB Offset Error VREF = 4V, VCC = 4V, ADC clock = 200 kHz 1.5 LSB Conversion Time Free Running Conversion Absolute accuracy (Including INL, DNL, and Quantization, Gain and Offset Errors) Clock Frequency VIN Max(1) Input Voltage 14 280 s 50 1000 kHz GND VREF V Input Bandwidth 38.4 kHz AREF External Voltage Reference 2.0 VINT Internal Voltage Reference 1.0 RREF Reference Input Resistance 32 k RAIN Analog Input Resistance 100 M ADC Conversion Output Note: 180 0 1.1 VCC V 1.2 V 1023 LSB 1. Values are guidelines only. ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Table 20-10. ADC Characteristics, Differential Channels (Unipolar Mode), TA = -40C to +85C Symbol Parameter Max(1) Units Gain = 1x 10 Bits Gain = 20x 10 Bits Condition Min(1) Typ(1) Resolution Absolute accuracy (Including INL, DNL, and Quantization, Gain and Offset Errors) Integral Non-Linearity (INL) (Accuracy after Offset and Gain Calibration) Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 10.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 20.0 LSB Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 4.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 10.0 LSB Gain = 1x 10.0 LSB Gain = 20x 15.0 LSB Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 3.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 4.0 LSB Gain Error Offset Error Conversion Time Clock Frequency VIN Input Voltage VDIFF Input Differential Voltage Free Running Conversion 70 280 s 50 200 kHz GND VCC V VREF/Gain V Input Bandwidth 4 kHz AREF External Reference Voltage 2.0 VINT Internal Voltage Reference 1.0 RREF Reference Input Resistance 32 k RAIN Analog Input Resistance 100 M ADC Conversion Output Note: 0 1.1 VCC - 1.0 V 1.2 V 1023 LSB 1. Values are guidelines only. 181 8006K-AVR-10/10 Table 20-11. ADC Characteristics, Differential Channels (Bipolar Mode), TA = -40C to +85C Symbol Parameter Max(1) Units Gain = 1x 10 Bits Gain = 20x 10 Bits Condition Min(1) Typ(1) Resolution Absolute accuracy (Including INL, DNL, and Quantization, Gain and Offset Errors) Integral Non-Linearity (INL) (Accuracy after Offset and Gain Calibration) Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 8.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 8.0 LSB Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 4.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 5.0 LSB Gain = 1x 4.0 LSB Gain = 20x 5.0 LSB Gain = 1x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 3.0 LSB Gain = 20x VREF = 4V, VCC = 5V ADC clock = 50 - 200 kHz 4.0 LSB Gain Error Offset Error Conversion Time Clock Frequency VIN Input Voltage VDIFF Input Differential Voltage Free Running Conversion 70 280 s 50 200 kHz GND VCC V VREF/Gain V Input Bandwidth 4 kHz AREF External Reference Voltage 2.0 VINT Internal Voltage Reference 1.0 RREF Reference Input Resistance 32 k RAIN Analog Input Resistance 100 M ADC Conversion Output Note: 182 -512 1.1 VCC - 1.0 V 1.2 V 511 LSB 1. Values are guidelines only. ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 20.8 Serial Programming Characteristics Figure 20-4. Serial Programming Timing MOSI SCK tSLSH tSHOX tOVSH tSHSL MISO Figure 20-5. Serial Programming Waveform SERIAL DATA INPUT (MOSI) MSB LSB SERIAL DATA OUTPUT (MISO) MSB LSB SERIAL CLOCK INPUT (SCK) SAMPLE Table 20-12. Serial Programming Characteristics, TA = -40C to +85C, VCC = 1.8 - 5.5V (Unless Otherwise Noted) Symbol Parameter 1/tCLCL Oscillator Frequency (ATtiny24/44/84V) Min 0 Oscillator Period (ATtiny24/44/84V) tCLCL Oscillator Freq. (ATtiny24/44/84, VCC = 4.5V - 5.5V) 0 tCLCL Oscillator Period (ATtiny24/44/84, VCC = 4.5V - 5.5V) 50 SCK Pulse Width High tSLSH SCK Pulse Width Low tOVSH MOSI Setup to SCK High tSHOX MOSI Hold after SCK High Note: Max Units 4 MHz 250 1/tCLCL tSHSL Typ ns 20 MHz ns 2 tCLCL(1) ns 2 tCLCL(1) ns tCLCL ns 2 tCLCL ns 1. 2 tCLCL for fck < 12 MHz, 3 tCLCL for fck >= 12 MHz 183 8006K-AVR-10/10 20.9 High-Voltage Serial Programming Characteristics Figure 20-6. High-voltage Serial Programming Timing SDI (PA6), SII (PA5) tIVSH SCI (PB0) tSLSH tSHIX tSHSL SDO (PA4) tSHOV Table 20-13. High-voltage Serial Programming Characteristics TA = 25C, VCC = 5V (Unless otherwise noted) Symbol Parameter Min tSHSL SCI (PB0) Pulse Width High 125 ns tSLSH SCI (PB0) Pulse Width Low 125 ns tIVSH SDI (PA6), SII (PB1) Valid to SCI (PB0) High 50 ns tSHIX SDI (PA6), SII (PB1) Hold after SCI (PB0) High 50 ns tSHOV SCI (PB0) High to SDO (PA4) Valid 16 ns Wait after Instr. 3 for Write Fuse Bits 2.5 ms tWLWH_PFB 184 Typ Max Units ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 21. Typical Characteristics The data contained in this section is largely based on simulations and characterization of similar devices in the same process and design methods. Thus, the data should be treated as indications of how the part will behave. The following charts show typical behavior. These figures are not tested during manufacturing. During characterisation devices are operated at frequencies higher than test limits but they are not guaranteed to function properly at frequencies higher than the ordering code indicates. All current consumption measurements are performed with all I/O pins configured as inputs and with internal pull-ups enabled. Current consumption is a function of several factors such as operating voltage, operating frequency, loading of I/O pins, switching rate of I/O pins, code executed and ambient temperature. The dominating factors are operating voltage and frequency. A sine wave generator with rail-to-rail output is used as clock source but current consumption in Power-Down mode is independent of clock selection. The difference between current consumption in Power-Down mode with Watchdog Timer enabled and Power-Down mode with Watchdog Timer disabled represents the differential current drawn by the Watchdog Timer. The current drawn from pins with a capacitive load may be estimated (for one pin) as follows: I CP V CC x C L x f SW where VCC = operating voltage, CL = load capacitance and fSW = average switching frequency of I/O pin. 21.1 Supply Current of I/O Modules The tables and formulas below can be used to calculate the additional current consumption for the different I/O modules in Active and Idle mode. The enabling or disabling of the I/O modules is controlled by the Power Reduction Register. See "Power Reduction Register" on page 35 for details. Table 21-1. Additional Current Consumption for the different I/O modules (absolute values) Typical numbers PRR bit VCC = 2V, f = 1MHz VCC = 3V, f = 4MHz VCC = 5V, f = 8MHz PRTIM1 5.1 A 31.0 A 118.2 A PRTIM0 6.6 A 40.0 A 153.0 A PRUSI 3.7 A 23.1 A 92.2 A PRADC 29.6 A 88.3 A 333.3 A Table 21-2 below can be used for calculating typical current consumption for other supply voltages and frequencies than those mentioned in the Table 21-1 above. 185 8006K-AVR-10/10 Table 21-2. Additional Current Consumption (percentage) in Active and Idle mode Current consumption additional to active mode with external clock (see Figure 21-1 and Figure 21-2) PRR bit 21.1.1 Current consumption additional to idle mode with external clock (see Figure 21-6 and Figure 21-7) PRTIM1 1.8 % 8.0 % PRTIM0 2.3 % 10.4 % PRUSI 1.4 % 6.1 % PRADC 6.7 % 28.8 % Example Calculate the expected current consumption in idle mode with USI, TIMER0, and ADC enabled at VCC = 2.0V and f = 1MHz. From Table 21-2 on page 186, third column, we see that we need to add 6.1% for the USI, 10.4% for TIMER0, and 28.8% for the ADC. Reading from Figure 21-6 on page 189, we find that current consumption in idle mode at 2V and 1MHz is about 0.04mA. The total current consumption in idle mode with USI, TIMER0, and ADC enabled is therefore: I CCTOT 0,04mA x ( 1 + 0,061 + 0,104 + 0,288 ) 0,06mA 21.2 Active Supply Current Figure 21-1. Active Supply Current vs. Low Frequency (0.1 - 1.0 MHz) ACTIVE SUPPLY CURRENT vs. LOW FREQUENCY (PRR=0xFF) 1.2 1 5.5 V 5.0 V 0.8 ICC (mA) 4.5 V 4.0 V 0.6 3.3 V 0.4 2.7 V 1.8 V 0.2 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency (MHz) 186 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-2. Active Supply Current vs. frequency (1 - 20 MHz) ACTIVE SUPPLY CURRENT vs. FREQUENCY (PRR=0xFF) 14 5.5 V 12 5.0 V ICC (mA) 10 4.5 V 8 6 4.0 V 4 3.3 V 2.7 V 2 1.8 V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency (MHz) Figure 21-3. Active Supply Current vs. VCC (Internal RC Oscillator, 8 MHz) ACTIVE SUPPLY CURRENT vs. SUPPLY VOLTAGE INTERNAL RC OSCILLATOR, 8 MHz 6 25 C 5 -40 C 85 C ICC (mA) 4 3 2 1 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 187 8006K-AVR-10/10 Figure 21-4. Active Supply Current vs. VCC (Internal RC Oscillator, 1 MHz) ACTIVE SUPPLY CURRENT vs. VCC INTERNAL RC OSCILLATOR, 1 MHz 1.2 85 C 25 C -40 C 1 ICC (mA) 0.8 0.6 0.4 0.2 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-5. Active Supply Current vs. VCC (Internal RC Oscillator, 128 kHz) ACTIVE SUPPLY CURRENT vs. VCC INTERNAL RC OSCILLATOR, 128 KHz 0.14 -40 C 25 C 85 C 0.12 ICC (mA) 0.1 0.08 0.06 0.04 0.02 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 188 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 21.3 Idle Supply Current Figure 21-6. Idle Supply Current vs. Low Frequency (0.1 - 1.0 MHz) IDLE SUPPLY CURRENT vs. LOW FREQUENCY (PRR=0xFF) ICC (mA) 0.18 0.16 5.5 V 0.14 5.0 V 0.12 4.5 V 0.1 4.0 V 0.08 3.3 V 0.06 2.7 V 0.04 1.8 V 0.02 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency (MHz) Figure 21-7. Idle Supply Current vs. Frequency (1 - 20 MHz) IDLE SUPPLY CURRENT vs. FREQUENCY (PRR=0xFF) 5 4.5 4 ICC (mA) 3.5 5.5 V 3 5.0 V 2.5 4.5 V 2 1.5 4.0 V 3.3 V 2.7 V 1 0.5 1.8 V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency (MHz) 189 8006K-AVR-10/10 Figure 21-8. Idle Supply Current vs. VCC (Internal RC Oscillator, 8 MHz) IDLE SUPPLY CURRENT vs. VCC INTERNAL RC OSCILLATOR, 8 MHz 2 1.8 1.6 85 C 1.4 25 C -40 C ICC (mA) 1.2 1 0.8 0.6 0.4 0.2 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-9. Idle Supply Current vs. VCC (Internal RC Oscillator, 1 MHz) IDLE SUPPLY CURRENT vs. VCC INTERNAL RC OSCILLATOR, 1 MHz 0.35 85 C 0.3 25 C -40 C ICC (mA) 0.25 0.2 0.15 0.1 0.05 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 190 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-10. Idle Supply Current vs. VCC (Internal RC Oscillator, 128 kHz) IDLE SUPPLY CURRENT vs. VCC INTERNAL RC OSCILLATOR, 128 KHz 0.03 -40 C 25 C 0.025 85 C ICC (mA) 0.02 0.015 0.01 0.005 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 21.4 Power-down Supply Current Figure 21-11. Power-down Supply Current vs. VCC (Watchdog Timer Disabled) POWER-DOWN SUPPLY CURRENT vs. VCC WATCHDOG TIMER DISABLED 0.7 85 C 0.6 ICC (uA) 0.5 0.4 0.3 0.2 25 C 0.1 -40 C 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 191 8006K-AVR-10/10 Figure 21-12. Power-down Supply Current vs. VCC (Watchdog Timer Enabled) POWER-DOWN SUPPLY CURRENT vs. VCC WATCHDOG TIMER ENABLED 10 9 -40 C 8 25 C 85 C 7 ICC (uA) 6 5 4 3 2 1 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 21.5 Standby Supply Current Figure 21-13. Standby Supply Current vs. VCC (4 MHz External Crystal, Watchdog Timer Disabled) STANDBY SUPPLY CURRENT vs. VCC 4 MHz EXTERNAL CRYSTAL, WATCHDOG TIMER DISABLED I CC (mA) 0.14 0.12 85 C 0.1 25 C 0.08 -40 C 0.06 0.04 0.02 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 192 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 21.6 Pin Pull-up Figure 21-14. I/O pin Pull-up Resistor Current vs. Input Voltage (VCC = 1.8V) I/O PIN PULL-UP RESISTOR CURRENT vs. INPUT VOLTAGE VCC = 1.8V 50 45 40 IOP (uA) 35 30 25 20 15 10 25 C 5 85 C -40 C 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 VOP (V) Figure 21-15. I/O Pin Pull-up Resistor Current vs. input Voltage (VCC = 2.7V) I/O PIN PULL-UP RESISTOR CURRENT vs. INPUT VOLTAGE VCC = 2.7V 80 70 60 IOP (uA) 50 40 30 20 25 C 10 85 C -40 C 0 0 0.5 1 1.5 2 2.5 3 VOP (V) 193 8006K-AVR-10/10 Figure 21-16. I/O pin Pull-up Resistor Current vs. Input Voltage (VCC = 5V) I/O PIN PULL-UP RESISTOR CURRENT vs. INPUT VOLTAGE VCC = 5V 160 140 120 IOP (uA) 100 80 60 40 25 C 20 85 C -40 C 0 0 1 2 3 4 5 6 VOP (V) Figure 21-17. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 1.8V) RESET PULL-UP RESISTOR CURRENT vs. RESET PIN VOLTAGE VCC = 1.8V 40 35 I RESET (uA) 30 25 20 15 10 25 C 5 -40 C 85 C 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 VRESET (V) 194 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-18. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 2.7V) RESET PULL-UP RESISTOR CURRENT vs. RESET PIN VOLTAGE VCC = 2.7V 60 50 I RESET(uA) 40 30 20 25 C 10 -40 C 85 C 0 0 0.5 1 1.5 2 2.5 3 VRESET (V) Figure 21-19. Reset Pull-up Resistor Current vs. Reset Pin Voltage (VCC = 5V) RESET PULL-UP RESISTOR CURRENT vs. RESET PIN VOLTAGE VCC = 5V 120 100 I RESET (uA) 80 60 40 25 C 20 -40 C 85 C 0 0 1 2 3 4 5 6 VRESET(V) 195 8006K-AVR-10/10 21.7 Pin Driver Strength Figure 21-20. I/O Pin Output Voltage vs. Sink Current (VCC = 3V) I/O PIN OUTPUT VOLTAGE vs. SINK CURRENT VCC = 3V 1 0.9 85 C 0.8 VOL (V) 0.7 25 C 0.6 -40 C 0.5 0.4 0.3 0.2 0.1 0 0 5 10 15 20 25 IOL (mA) Figure 21-21. I/O pin Output Voltage vs. Sink Current (VCC = 5V) I/O PIN OUTPUT VOLTAGE vs. SINK CURRENT VCC = 5V 0.7 0.6 85 C VOL (V) 0.5 25 C 0.4 -40 C 0.3 0.2 0.1 0 0 5 10 15 20 25 IOL (mA) 196 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-22. I/O Pin Output Voltage vs. Source Current (VCC = 3V) I/O PIN OUTPUT VOLTAGE vs. SOURCE CURRENT VCC = 3V 3.5 3 VOH (V) 2.5 -40 C 25 C 85 C 2 1.5 1 0.5 0 0 5 10 15 20 25 IOH (mA) Figure 21-23. I/O Pin output Voltage vs. Source Current (VCC = 5V) I/O PIN OUTPUT VOLTAGE vs. SOURCE CURRENT VCC = 5V 5.1 5 4.9 VOH (V) 4.8 4.7 4.6 -40 C 4.5 25 C 85 C 4.4 4.3 0 5 10 15 20 25 IOH (mA) 197 8006K-AVR-10/10 Figure 21-24. Reset Pin Output Voltage vs. Sink Current (VCC = 3V) RESET AS I/O PIN OUTPUT VOLTAGE vs. SINK CURRENT VCC = 3V 1.5 85 C VOL (V) 1 0 C -45 C 0.5 0 0 0.5 1 1.5 2 2.5 3 IOL (mA) Figure 21-25. Reset Pin Output Voltage vs. Sink Current (VCC = 5V) RESET AS I/O PIN OUTPUT VOLTAGE vs. SINK CURRENT VCC = 5V 1 0.8 VOL (V) 0.6 85 C 0.4 0 C -45 C 0.2 0 0 0.5 1 1.5 2 2.5 3 IOL (mA) 198 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-26. Reset Pin Output Voltage vs. Source Current (VCC = 3V) RESET AS I/O PIN OUTPUT VOLTAGE vs. SOURCE CURRENT VCC = 3V 3.5 3 VOH (V) 2.5 2 1.5 -45 C 25 C 85 C 1 0.5 0 0 0.5 1 1.5 2 IOH (mA) Figure 21-27. Reset Pin Output Voltage vs. Source Current (VCC = 5V) RESET AS I/O PIN OUTPUT VOLTAGE vs. SOURCE CURRENT VCC = 5V 5 4.5 VOH (V) 4 3.5 3 -45 C 25 C 85 C 2.5 0 0.5 1 1.5 2 IOH (mA) 199 8006K-AVR-10/10 21.8 Pin Threshold and Hysteresis Figure 21-28. I/O Pin Input Threshold Voltage vs. VCC (VIH, IO Pin Read as `1') I/O PIN INPUT THRESHOLD VOLTAGE vs. VCC VIH, IO PIN READ AS '1' 3.5 85 C 25 C -40 C Threshold (V) 3 2.5 2 1.5 1 0.5 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-29. I/O Pin Input threshold Voltage vs. VCC (VIL, IO Pin Read as `0') I/O PIN INPUT THRESHOLD VOLTAGE vs. VCC VIL, IO PIN READ AS '0' 2.5 85 C 25 C Threshold (V) 2 -40 C 1.5 1 0.5 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 200 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-30. I/O Pin Input Hysteresis vs. VCC I/O PIN INPUT HYSTERESIS vs. VCC 0.6 Input Hysteresis (V) 0.5 85 C -40 C 0.4 25 C 0.3 0.2 0.1 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-31. Reset Input Threshold Voltage vs. VCC (VIH, I/O Pin Threshold as `1') RESET INPUT THRESHOLD VOLTAGE vs. VCC VIH, IO PIN READ AS '1' 2.5 -40 C 25 C 2 Threshold (V) 85 C 1.5 1 0.5 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 201 8006K-AVR-10/10 Figure 21-32. Reset Input Threshold Voltage vs. VCC (VIL, I/O pin Read as `0') RESET INPUT THRESHOLD VOLTAGE vs. V CC VIL, IO PIN READ AS '0' 2.5 85 C 25 C 2 Threshold (V) -40 C 1.5 1 0.5 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-33. Reset Pin Input Hysteresis vs. VCC RESET PIN INPUT HYSTERESIS vs. VCC 0.8 Input Hysteresis (V) 0.7 0.6 0.5 0.4 0.3 0.2 -40 C 25 C 85 C 0.1 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 202 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-34. Reset Pin Input Hysteresis vs. VCC (Reset Pin Used as I/O) RESET PIN AS I/O, INPUT HYSTERESIS vs. VCC V IL , I/O PIN READ AS "0" 1 0.9 0.8 -40 C Input Hysteresis (V) 0.7 25 C 0.6 85 C 0.5 0.4 0.3 0.2 0.1 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 V CC (V) 21.9 BOD Threshold and Analog Comparator Offset Figure 21-35. BOD Threshold vs. Temperature (BODLEVEL is 4.3V) BOD THRESHOLDS vs. TEMPERATURE BODLEVEL is 4.3V 4.34 4.32 Rising Vcc Threshold (V) 4.3 4.28 4.26 4.24 4.22 Falling Vcc 4.2 4.18 4.16 4.14 -60 -40 -20 0 20 40 60 80 100 Temperature (C) 203 8006K-AVR-10/10 Figure 21-36. BOD Threshold vs. Temperature (BODLEVEL is 2.7V) BOD THRESHOLDS vs. TEMPERATURE BODLEVEL is 2.7V 2.75 Rising Vcc 2.74 2.73 Threshold (V) 2.72 2.71 2.7 2.69 2.68 2.67 Falling Vcc 2.66 2.65 2.64 -60 -40 -20 0 20 40 60 80 100 Temperature (C) Figure 21-37. BOD Threshold vs. Temperature (BODLEVEL is 1.8V) BOD THRESHOLDS vs. TEMPERATURE BODLEVEL is 1.8V 1.82 Rising Vcc 1.815 Threshold (V) 1.81 1.805 1.8 1.795 1.79 Falling Vcc 1.785 1.78 1.775 1.77 -60 -40 -20 0 20 40 60 80 100 Temperature (C) 204 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 21.10 Internal Oscillator Speed Figure 21-38. Watchdog Oscillator Frequency vs. VCC WATCHDOG OSCILLATOR FREQUENCY vs. OPERATING VOLTAGE 110 109 108 Frequency (kHz) 107 -40 C 106 105 25 C 104 103 102 101 85 C 100 99 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-39. Watchdog Oscillator Frequency vs. Temperature WATCHDOG OSCILLATOR FREQUENCY vs. TEMPERATURE 110 109 108 Frequency (kHz) 107 106 105 104 1.8 V 103 2.7 V 102 3.3 V 101 4.0 V 5.5 V 100 -60 -40 -20 0 20 40 60 80 100 Temperature 205 8006K-AVR-10/10 Figure 21-40. Calibrated 8 MHz RC Oscillator Frequency vs. VCC CALIBRATED 8.0MHz RC OSCILLATOR FREQUENCY vs. OPERATING VOLTAGE 9 85 C 8 25 C -40 C Frequency (MHz) 7 6 5 4 3 2 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-41. Calibrated 8 MHz RC oscillator Frequency vs. Temperature CALIBRATED 8.0MHz RC OSCILLATOR FREQUENCY vs. TEMPERATURE 8.3 5.0 V 8.2 3.0 V Frequency (MHz) 8.1 8 7.9 7.8 7.7 7.6 -60 -40 -20 0 20 40 60 80 100 Temperature 206 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-42. Calibrated 8 MHz RC Oscillator Frequency vs. OSCCAL Value CALIBRATED 8 MHz RC OSCILLATOR FREQUENCY vs. OSCCAL VALUE 16 FRC (MHz) 85 C 14 25 C 12 -40 C 10 8 6 4 2 0 0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 OSCCAL (X1) 21.11 Current Consumption of Peripheral Units Figure 21-43. ADC Current vs. VCC ADC CURRENT vs. VCC 4.0 MHz FREQUENCY 700 600 ICC (uA) 500 400 300 200 100 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 207 8006K-AVR-10/10 Figure 21-44. AREF External Reference Current vs. VCC AREF EXTERNAL REFERENCE CURRENT vs. VCC 180 25 C 150 ICC (uA) 120 90 60 30 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC (V) Figure 21-45. Analog Comparator Current vs. VCC ANALOG COMPARATOR CURRENT vs. VCC 140 120 ICC (uA) 100 25 C 80 60 40 20 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC (V) 208 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-46. Programming Current vs. VCC (ATtiny24) PROGRAMMING CURRENT vs. VCC ATtiny24 8000 7000 25 C 6000 ICC (uA) 5000 4000 3000 2000 1000 0 1.5 2.5 3.5 4.5 5.5 VCC (V) Figure 21-47. Programming Current vs. VCC (ATtiny44) PROGRAMMING CURRENT vs. VCC ATtiny44 9000 8000 25 C 7000 ICC (uA) 6000 5000 4000 3000 2000 1000 0 1.5 2.5 3.5 4.5 5.5 VCC (V) 209 8006K-AVR-10/10 Figure 21-48. Programming Current vs. VCC (ATtiny84) PROGRAMMING CURRENT vs. VCC ATtiny84 16000 25 C 14000 12000 ICC (uA) 10000 8000 6000 4000 2000 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) Figure 21-49. Brownout Detector Current vs. VCC BROWNOUT DETECTOR CURRENT vs. VCC 45 40 35 ICC (uA) 30 85 C 25 C -40 C 25 20 15 10 5 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 VCC (V) 210 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Figure 21-50. Watchdog Timer Current vs. VCC WATCHDOG TIMER CURRENT vs. VCC 10 9 -40 C 85 C 8 ICC (uA) 7 25 C 6 5 4 3 2 1 0 1,5 2 2,5 3 3,5 4 4,5 5 5,5 VCC (V) 21.12 Current Consumption in Reset and Reset Pulsewidth Figure 21-51. Reset Supply Current vs. VCC (0.1 - 1.0 MHz, excluding Current Through the Reset Pull-up) RESET SUPPLY CURRENT vs. VCC 0.1 - 1.0 MHz,EXCLUDING CURRENT THROUGH THE RESET PULLUP 0.14 5.5 V 0.12 5.0 V ICC (mA) 0.1 4.5 V 0.08 4.0 V 0.06 3.3 V 2.7 V 0.04 1.8 V 0.02 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 Frequency (MHz) 211 8006K-AVR-10/10 Figure 21-52. Reset Supply Current vs. VCC (1 - 20 MHz, Excluding Current Through the Reset Pull-up) RESET SUPPLY CURRENT vs. VCC 1 - 20 MHz, EXCLUDING CURRENT THROUGH THE RESET PULLUP 3 2.5 5.5 V 5.0 V 4.5 V ICC (mA) 2 1.5 1 4.0V 3.3V 2.7V 0.5 1.8V 0 0 2 4 6 8 10 12 14 16 18 20 Frequency (MHz) Figure 21-53. Minimum Reset Pulse Width vs. VCC MINIMUM RESET PULSE WIDTH vs. VCC 2500 Pulsewidth (ns) 2000 1500 1000 500 85 C 25 C -40 C 0 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6 VCC (V) 212 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 22. Register Summary Address Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Page 0x3F (0x5F) SREG I T H S V N Z C Page 8 - - - - SP9 SP8 Page 11 SP1 SP0 0x3E (0x5E) SPH - - 0x3D (0x5D) SPL SP7 SP6 0x3C (0x5C) OCR0B 0x3B (0x5B) GIMSK - INT0 PCIE1 PCIE0 - - - - Page 51 0x3A (0x5A GIFR - INTF0 PCIF1 PCIF0 - - - - Page 52 0x39 (0x59) TIMSK0 - - - - - OCIE0B OCIE0A TOIE0 Page 85 0x38 (0x58) TIFR0 - - - - OCF0B OCF0A TOV0 Page 85 0x37 (0x57) SPMCSR RSIG CTPB RFLB PGWRT Timer/Counter0 - Output Compare Register A PGERS SPMEN Page 157 0x36 (0x56) OCR0A 0x35 (0x55) MCUCR SP5 SP4 SP3 SP2 Timer/Counter0 - Output Compare Register B - - BODS PUD SE SM1 Page 11 Page 85 Page 84 SM0 BODSE ISC01 ISC00 Pages 36, 51, and 67 0x34 (0x54) MCUSR - - - - WDRF BORF EXTRF PORF Page 45 0x33 (0x53) TCCR0B FOC0A FOC0B - - WGM02 CS02 CS01 CS00 Page 83 0x32 (0x52) TCNT0 0x31 (0x51) OSCCAL CAL2 CAL1 CAL0 Page 30 Timer/Counter0 CAL7 CAL6 CAL5 CAL4 CAL3 Page 84 0x30 (0x50) TCCR0A COM0A1 COM0A0 COM0B1 COM0B0 - WGM01 WGM00 Page 80 0x2F (0x4F) TCCR1A COM1A1 COM1A0 COM1B1 COM1B0 - WGM11 WGM10 Page 108 ICNC1 ICES1 - WGM13 WGM12 CS11 CS10 Page 110 CS12 0x2E (0x4E) TCCR1B 0x2D (0x4D) TCNT1H Timer/Counter1 - Counter Register High Byte Page 112 0x2C (0x4C) TCNT1L Timer/Counter1 - Counter Register Low Byte Page 112 0x2B (0x4B) OCR1AH Timer/Counter1 - Compare Register A High Byte Page 112 0x2A (0x4A) OCR1AL Timer/Counter1 - Compare Register A Low Byte Page 112 0x29 (0x49) OCR1BH Timer/Counter1 - Compare Register B High Byte Page 112 Page 112 0x28 (0x48) OCR1BL Timer/Counter1 - Compare Register B Low Byte 0x27 (0x47) DWDR DWDR[7:0] 0x26 (0x46) CLKPR 0x25 (0x45) ICR1H CLKPCE - - - Page 152 CLKPS3 CLKPS2 CLKPS1 CLKPS0 Timer/Counter1 - Input Capture Register High Byte Page 31 Page 113 Timer/Counter1 - Input Capture Register Low Byte 0x24 (0x44) ICR1L 0x23 (0x43) GTCCR TSM - - - - - - PSR10 Page 113 Page 116 0x22 (0x42) TCCR1C FOC1A FOC1B - - - - - - Page 111 0x21 (0x41) WDTCSR WDIF WDIE WDP3 WDCE WDE WDP2 WDP1 WDP0 Page 45 0x20 (0x40) PCMSK1 - - - - PCINT11 PCINT10 PCINT9 PCINT8 Page 52 Page 20 0x1F (0x3F) EEARH - - - - - - - EEAR8 0x1E (0x3E) EEARL EEAR7 EEAR6 EEAR5 EEAR4 EEAR3 EEAR2 EEAR1 EEAR0 0x1D (0x3D) EEDR EEPROM Data Register Page 21 Page 21 0x1C (0x3C) EECR - - EEPM1 EEPM0 EERIE EEMPE EEPE EERE Page 21 0x1B (0x3B) PORTA PORTA7 PORTA6 PORTA5 PORTA4 PORTA3 PORTA2 PORTA1 PORTA0 Page 67 0x1A (0x3A) DDRA DDA7 DDA6 DDA5 DDA4 DDA3 DDA2 DDA1 DDA0 Page 67 0x19 (0x39) PINA PINA7 PINA6 PINA5 PINA4 PINA3 PINA2 PINA1 PINA0 Page 68 0x18 (0x38) PORTB - - - - PORTB3 PORTB2 PORTB1 PORTB0 Page 68 0x17 (0x37) DDRB - - - - DDB3 DDB2 DDB1 DDB0 Page 68 0x16 (0x36) PINB - - - - PINB3 PINB2 PINB1 PINB0 0x15 (0x35) GPIOR2 General Purpose I/O Register 2 Page 23 0x14 (0x34) GPIOR1 General Purpose I/O Register 1 Page 23 0x13 (0x33) GPIOR0 General Purpose I/O Register 0 0x12 (0x32) PCMSK0 0x11 (0x31)) Reserved - 0x10 (0x30) USIBR USI Buffer Register Page 125 0x0F (0x2F) USIDR USI Data Register Page 124 PCINT7 PCINT6 PCINT5 PCINT4 PCINT3 Page 68 Page 23 PCINT2 PCINT1 PCINT0 Page 53 0x0E (0x2E) USISR USISIF USIOIF USIPF USIDC USICNT3 USICNT2 USICNT1 USICNT0 0x0D (0x2D) USICR USISIE USIOIE USIWM1 USIWM0 USICS1 USICS0 USICLK USITC Page 126 0x0C (0x2C) TIMSK1 - - ICIE1 - - OCIE1B OCIE1A TOIE1 Page 113 0x0B (0x2B) TIFR1 - - ICF1 - - OCF1B OCF1A TOV1 Page 114 0x0A (0x2A) Reserved 0x09 (0x29) Reserved 0x08 (0x28) ACSR ACD ACBG ACO ACI ACIE ACIC ACIS1 ACIS0 Page 130 0x07 (0x27) ADMUX REFS1 REFS0 MUX5 MUX4 MUX3 MUX2 MUX1 MUX0 Page 145 0x06 (0x26) ADCSRA ADEN ADSC ADATE ADIF ADIE ADPS2 ADPS1 ADPS0 0x05 (0x25) ADCH 0x04 (0x24) ADCL 0x03 (0x23) ADCSRB 0x02 (0x22) Reserved 0x01 (0x21) 0x00 (0x20) Page 125 - - ADC Data Register High Byte ADC Data Register Low Byte BIN ACME - ADLAR DIDR0 ADC7D ADC6D ADC5D ADC4D PRR - - - - - Page 147 Page 149 Page 149 ADTS2 ADTS1 ADTS0 Page 131, Page 149 ADC3D ADC2D PRTIM1 PRTIM0 ADC1D ADC0D Page 131, Page 150 PRUSI PRADC Page 37 - 213 8006K-AVR-10/10 Note: 1. For compatibility with future devices, reserved bits should be written to zero if accessed. Reserved I/O memory addresses should never be written. 2. I/O Registers within the address range 0x00 - 0x1F are directly bit-accessible using the SBI and CBI instructions. In these registers, the value of single bits can be checked by using the SBIS and SBIC instructions. 3. Some of the Status Flags are cleared by writing a logical one to them. Note that, unlike most other AVRs, the CBI and SBI instructions will only operation the specified bit, and can therefore be used on registers containing such Status Flags. The CBI and SBI instructions work with registers 0x00 to 0x1F only. 214 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 23. Instruction Set Summary Mnemonics Operands Description Operation Flags #Clocks ARITHMETIC AND LOGIC INSTRUCTIONS ADD Rd, Rr Add two Registers Rd Rd + Rr Z,C,N,V,H ADC Rd, Rr Add with Carry two Registers Rd Rd + Rr + C Z,C,N,V,H 1 ADIW Rdl,K Add Immediate to Word Rdh:Rdl Rdh:Rdl + K Z,C,N,V,S 2 SUB Rd, Rr Subtract two Registers Rd Rd - Rr Z,C,N,V,H 1 SUBI Rd, K Subtract Constant from Register Rd Rd - K Z,C,N,V,H 1 SBC Rd, Rr Subtract with Carry two Registers Rd Rd - Rr - C Z,C,N,V,H 1 SBCI Rd, K Subtract with Carry Constant from Reg. Rd Rd - K - C Z,C,N,V,H 1 SBIW Rdl,K Subtract Immediate from Word Rdh:Rdl Rdh:Rdl - K Z,C,N,V,S 2 AND Rd, Rr Logical AND Registers Rd Rd * Rr Z,N,V 1 ANDI Rd, K Logical AND Register and Constant Rd Rd * K Z,N,V 1 OR Rd, Rr Logical OR Registers Rd Rd v Rr Z,N,V 1 ORI Rd, K Logical OR Register and Constant Rd Rd v K Z,N,V 1 EOR Rd, Rr Exclusive OR Registers Rd Rd Rr Z,N,V 1 1 COM Rd One's Complement Rd 0xFF - Rd Z,C,N,V 1 NEG Rd Two's Complement Rd 0x00 - Rd Z,C,N,V,H 1 SBR Rd,K Set Bit(s) in Register Rd Rd v K Z,N,V 1 CBR Rd,K Clear Bit(s) in Register Rd Rd * (0xFF - K) Z,N,V 1 INC Rd Increment Rd Rd + 1 Z,N,V 1 DEC Rd Decrement Rd Rd - 1 Z,N,V 1 TST Rd Test for Zero or Minus Rd Rd * Rd Z,N,V 1 CLR Rd Clear Register Rd Rd Rd Z,N,V 1 SER Rd Set Register Rd 0xFF None 1 2 BRANCH INSTRUCTIONS RJMP k IJMP RCALL k Relative Jump PC PC + k + 1 None Indirect Jump to (Z) PC Z None 2 Relative Subroutine Call PC PC + k + 1 None 3 3 ICALL Indirect Call to (Z) PC Z None RET Subroutine Return PC STACK None 4 RETI Interrupt Return PC STACK I 4 CPSE Rd,Rr Compare, Skip if Equal if (Rd = Rr) PC PC + 2 or 3 None CP Rd,Rr Compare Rd - Rr Z, N,V,C,H 1 CPC Rd,Rr Compare with Carry Rd - Rr - C Z, N,V,C,H 1 CPI Rd,K Compare Register with Immediate Rd - K Z, N,V,C,H SBRC Rr, b Skip if Bit in Register Cleared if (Rr(b)=0) PC PC + 2 or 3 None 1/2/3 1/2/3 1 SBRS Rr, b Skip if Bit in Register is Set if (Rr(b)=1) PC PC + 2 or 3 None 1/2/3 SBIC P, b Skip if Bit in I/O Register Cleared if (P(b)=0) PC PC + 2 or 3 None 1/2/3 SBIS P, b Skip if Bit in I/O Register is Set if (P(b)=1) PC PC + 2 or 3 None 1/2/3 BRBS s, k Branch if Status Flag Set if (SREG(s) = 1) then PCPC+k + 1 None 1/2 BRBC s, k Branch if Status Flag Cleared if (SREG(s) = 0) then PCPC+k + 1 None 1/2 BREQ k Branch if Equal if (Z = 1) then PC PC + k + 1 None 1/2 BRNE k Branch if Not Equal if (Z = 0) then PC PC + k + 1 None 1/2 BRCS k Branch if Carry Set if (C = 1) then PC PC + k + 1 None 1/2 BRCC k Branch if Carry Cleared if (C = 0) then PC PC + k + 1 None 1/2 BRSH k Branch if Same or Higher if (C = 0) then PC PC + k + 1 None 1/2 BRLO k Branch if Lower if (C = 1) then PC PC + k + 1 None 1/2 BRMI k Branch if Minus if (N = 1) then PC PC + k + 1 None 1/2 BRPL k Branch if Plus if (N = 0) then PC PC + k + 1 None 1/2 BRGE k Branch if Greater or Equal, Signed if (N V= 0) then PC PC + k + 1 None 1/2 BRLT k Branch if Less Than Zero, Signed if (N V= 1) then PC PC + k + 1 None 1/2 BRHS k Branch if Half Carry Flag Set if (H = 1) then PC PC + k + 1 None 1/2 BRHC k Branch if Half Carry Flag Cleared if (H = 0) then PC PC + k + 1 None 1/2 BRTS k Branch if T Flag Set if (T = 1) then PC PC + k + 1 None 1/2 BRTC k Branch if T Flag Cleared if (T = 0) then PC PC + k + 1 None 1/2 BRVS k Branch if Overflow Flag is Set if (V = 1) then PC PC + k + 1 None 1/2 BRVC k Branch if Overflow Flag is Cleared if (V = 0) then PC PC + k + 1 None 1/2 BRIE k Branch if Interrupt Enabled if ( I = 1) then PC PC + k + 1 None 1/2 BRID k Branch if Interrupt Disabled if ( I = 0) then PC PC + k + 1 None 1/2 BIT AND BIT-TEST INSTRUCTIONS SBI P,b Set Bit in I/O Register I/O(P,b) 1 None 2 CBI P,b Clear Bit in I/O Register I/O(P,b) 0 None 2 LSL Rd Logical Shift Left Rd(n+1) Rd(n), Rd(0) 0 Z,C,N,V 1 LSR Rd Logical Shift Right Rd(n) Rd(n+1), Rd(7) 0 Z,C,N,V 1 ROL Rd Rotate Left Through Carry Rd(0)C,Rd(n+1) Rd(n),CRd(7) Z,C,N,V 1 215 8006K-AVR-10/10 Mnemonics Operands Description Operation Flags #Clocks ROR Rd Rotate Right Through Carry Rd(7)C,Rd(n) Rd(n+1),CRd(0) Z,C,N,V 1 ASR Rd Arithmetic Shift Right Rd(n) Rd(n+1), n=0..6 Z,C,N,V 1 SWAP Rd Swap Nibbles Rd(3..0)Rd(7..4),Rd(7..4)Rd(3..0) None 1 BSET s Flag Set SREG(s) 1 SREG(s) 1 BCLR s Flag Clear SREG(s) 0 SREG(s) 1 BST Rr, b Bit Store from Register to T T Rr(b) T 1 BLD Rd, b Bit load from T to Register Rd(b) T None 1 SEC Set Carry C1 C 1 CLC Clear Carry C0 C 1 SEN Set Negative Flag N1 N 1 CLN Clear Negative Flag N0 N 1 SEZ Set Zero Flag Z1 Z 1 CLZ Clear Zero Flag Z0 Z 1 SEI Global Interrupt Enable I1 I 1 CLI Global Interrupt Disable I0 I 1 SES Set Signed Test Flag S1 S 1 CLS Clear Signed Test Flag S0 S 1 SEV Set Twos Complement Overflow. V1 V 1 CLV Clear Twos Complement Overflow V0 V 1 SET Set T in SREG T1 T 1 CLT Clear T in SREG T0 T 1 SEH CLH Set Half Carry Flag in SREG Clear Half Carry Flag in SREG H1 H0 H H 1 Rd Rr Rd+1:Rd Rr+1:Rr None 1 None 1 1 1 DATA TRANSFER INSTRUCTIONS MOV Rd, Rr Move Between Registers MOVW Rd, Rr Copy Register Word LDI Rd, K Load Immediate Rd K None LD Rd, X Load Indirect Rd (X) None 2 LD Rd, X+ Load Indirect and Post-Inc. Rd (X), X X + 1 None 2 2 LD Rd, - X Load Indirect and Pre-Dec. X X - 1, Rd (X) None LD Rd, Y Load Indirect Rd (Y) None 2 LD Rd, Y+ Load Indirect and Post-Inc. Rd (Y), Y Y + 1 None 2 2 LD Rd, - Y Load Indirect and Pre-Dec. Y Y - 1, Rd (Y) None LDD Rd,Y+q Load Indirect with Displacement Rd (Y + q) None 2 LD Rd, Z Load Indirect Rd (Z) None 2 LD Rd, Z+ Load Indirect and Post-Inc. Rd (Z), Z Z+1 None 2 LD Rd, -Z Load Indirect and Pre-Dec. Z Z - 1, Rd (Z) None 2 LDD Rd, Z+q Load Indirect with Displacement Rd (Z + q) None 2 LDS Rd, k Load Direct from SRAM Rd (k) None 2 ST X, Rr Store Indirect (X) Rr None 2 ST X+, Rr Store Indirect and Post-Inc. (X) Rr, X X + 1 None 2 ST - X, Rr Store Indirect and Pre-Dec. X X - 1, (X) Rr None 2 ST Y, Rr Store Indirect (Y) Rr None 2 ST Y+, Rr Store Indirect and Post-Inc. (Y) Rr, Y Y + 1 None 2 ST - Y, Rr Store Indirect and Pre-Dec. Y Y - 1, (Y) Rr None 2 STD Y+q,Rr Store Indirect with Displacement (Y + q) Rr None 2 ST Z, Rr Store Indirect (Z) Rr None 2 ST Z+, Rr Store Indirect and Post-Inc. (Z) Rr, Z Z + 1 None 2 ST -Z, Rr Store Indirect and Pre-Dec. Z Z - 1, (Z) Rr None 2 STD Z+q,Rr Store Indirect with Displacement (Z + q) Rr None 2 STS k, Rr Store Direct to SRAM (k) Rr None 2 Load Program Memory R0 (Z) None 3 LPM LPM Rd, Z Load Program Memory Rd (Z) None 3 LPM Rd, Z+ Load Program Memory and Post-Inc Rd (Z), Z Z+1 None 3 Store Program Memory (z) R1:R0 None IN Rd, P In Port Rd P None OUT P, Rr Out Port P Rr None 1 PUSH Rr Push Register on Stack STACK Rr None 2 POP Rd Pop Register from Stack Rd STACK None 2 SPM 1 MCU CONTROL INSTRUCTIONS NOP No Operation None 1 SLEEP Sleep (see specific descr. for Sleep function) None 1 WDR BREAK Watchdog Reset Break (see specific descr. for WDR/Timer) For On-chip Debug Only None None 1 N/A 216 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 24. Ordering Information 24.1 ATtiny24 Speed (MHz) 10 20 Notes: Ordering Code(1) Package(2) 1.8 - 5.5V ATtiny24V-10SSU ATtiny24V-10SSUR ATtiny24V-10PU ATtiny24V-10MU ATtiny24V-10MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) 2.7 - 5.5V ATtiny24-20SSU ATtiny24-20SSUR ATtiny24-20PU ATtiny24-20MU ATtiny24-20MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) Power Supply Operational Range 1. Code indicators: - U: matte tin - R: tape & reel 2. All packages are Pb-free, halide-free and fully green and they comply with the European directive for Restriction of Hazardous Substances (RoHS). 3. These devices can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering information and minimum quantities. Package Type 14S1 14-lead, 0.150" Wide Body, Plastic Gull Wing Small Outline Package (SOIC) 14P3 14-lead, 0.300" Wide, Plastic Dual Inline Package (PDIP) 20M1 20-pad, 4 x 4 x 0.8 mm Body, Quad Flat No-Lead/Micro Lead Frame Package (QFN/MLF) 217 8006K-AVR-10/10 24.2 ATtiny44 Speed (MHz) 10 20 Notes: Ordering Code(1) Package(2) 1.8 - 5.5V ATtiny44V-10SSU ATtiny44V-10SSUR ATtiny44V-10PU ATtiny44V-10MU ATtiny44V-10MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) 2.7 - 5.5V ATtiny44-20SSU ATtiny44-20SSUR ATtiny44-20PU ATtiny44-20MU ATtiny44-20MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) Power Supply Operational Range 1. Code indicators: - U: matte tin - R: tape & reel 2. All packages are Pb-free, halide-free and fully green and they comply with the European directive for Restriction of Hazardous Substances (RoHS). 3. These devices can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering information and minimum quantities. Package Type 14S1 14-lead, 0.150" Wide Body, Plastic Gull Wing Small Outline Package (SOIC) 14P3 14-lead, 0.300" Wide, Plastic Dual Inline Package (PDIP) 20M1 20-pad, 4 x 4 x 0.8 mm Body, Quad Flat No-Lead/Micro Lead Frame Package (QFN/MLF) 218 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 24.3 ATtiny84 Speed (MHz) 10 20 Notes: Ordering Code(1) Package(2) 1.8 - 5.5V ATtiny84V-10SSU ATtiny84V-10SSUR ATtiny84V-10PU ATtiny84V-10MU ATtiny84V-10MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) 2.7 - 5.5V ATtiny84-20SSU ATtiny84-20SSUR ATtiny84-20PU ATtiny84-20MU ATtiny84-20MUR 14S1 14S1 14P3 20M1 20M1 Industrial (-40C to +85C)(3) Power Supply Operational Range 1. Code indicators: - U: matte tin - R: tape & reel 2. All packages are Pb-free, halide-free and fully green and they comply with the European directive for Restriction of Hazardous Substances (RoHS). 3. These devices can also be supplied in wafer form. Please contact your local Atmel sales office for detailed ordering information and minimum quantities. Package Type 14S1 14-lead, 0.150" Wide Body, Plastic Gull Wing Small Outline Package (SOIC) 14P3 14-lead, 0.300" Wide, Plastic Dual Inline Package (PDIP) 20M1 20-pad, 4 x 4 x 0.8 mm Body, Quad Flat No-Lead/Micro Lead Frame Package (QFN/MLF) 219 8006K-AVR-10/10 25. Packaging Information 25.1 20M1 D 1 Pin 1 ID 2 SIDE VIEW E 3 TOP VIEW A2 D2 A1 A 0.08 1 2 Pin #1 Notch (0.20 R) 3 COMMON DIMENSIONS (Unit of Measure = mm) E2 b L e BOTTOM VIEW SYMBOL MIN A 0.70 0.75 0.80 A1 - 0.01 0.05 A2 b D D2 E2 L MAX NOTE 0.23 0.30 4.00 BSC 2.45 2.60 2.75 4.00 BSC 2.45 e Reference JEDEC Standard MO-220, Fig. 1 (SAW Singulation) WGGD-5. NOM 0.20 REF 0.18 E Note: C 2.60 2.75 0.50 BSC 0.35 0.40 0.55 10/27/04 R 220 2325 Orchard Parkway San Jose, CA 95131 TITLE 20M1, 20-pad, 4 x 4 x 0.8 mm Body, Lead Pitch 0.50 mm, 2.6 mm Exposed Pad, Micro Lead Frame Package (MLF) DRAWING NO. 20M1 REV. A ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 25.2 14P3 D PIN 1 E1 A SEATING PLANE A1 L B B1 e E COMMON DIMENSIONS (Unit of Measure = mm) C eC eB Notes: 1. This package conforms to JEDEC reference MS-001, Variation AA. 2. Dimensions D and E1 do not include mold Flash or Protrusion. Mold Flash or Protrusion shall not exceed 0.25 mm (0.010"). MIN NOM MAX A - - 5.334 A1 0.381 - - D 18.669 - 19.685 E 7.620 - 8.255 E1 6.096 - 7.112 B 0.356 - 0.559 B1 1.143 - 1.778 L 2.921 - 3.810 C 0.203 - 0.356 eB - - 10.922 eC 0.000 - 1.524 SYMBOL e NOTE Note 2 Note 2 2.540 TYP 11/02/05 R 2325 Orchard Parkway San Jose, CA 95131 TITLE 14P3, 14-lead (0.300"/7.62 mm Wide) Plastic Dual Inline Package (PDIP) DRAWING NO. 14P3 REV. A 221 8006K-AVR-10/10 25.3 14S1 1 E H E N L Top View End View e COMMON DIMENSIONS (Unit of Measure = mm/inches) b SYMBOL A1 A D Side View NOM MAX - 1.75/0.0688 NOTE 1.35/0.0532 A1 0.1/.0040 - 0.25/0.0098 b 0.33/0.0130 - 0.5/0.0200 5 D 8.55/0.3367 - 8.74/0.3444 2 E 3.8/0.1497 - 3.99/0.1574 3 H 5.8/0.2284 - 6.19/0.2440 L 0.41/0.0160 - 1.27/0.0500 e Notes: MIN A 4 1.27/0.050 BSC 1. This drawing is for general information only; refer to JEDEC Drawing MS-012, Variation AB for additional information. 2. Dimension D does not include mold Flash, protrusions or gate burrs. Mold Flash, protrusion and gate burrs shall not exceed 0.15 mm (0.006") per side. 3. Dimension E does not include inter-lead Flash or protrusion. Inter-lead flash and protrusions shall not exceed 0.25 mm (0.010") per side. 4. L is the length of the terminal for soldering to a substrate. 5. The lead width B, as measured 0.36 mm (0.014") or greater above the seating plane, shall not exceed a maximum value of 0.61 mm (0.024") per side. 2/5/02 TITLE R 222 2325 Orchard Parkway San Jose, CA 95131 DRAWING NO. 14S1, 14-lead, 0.150" Wide Body, Plastic Gull Wing Small Outline Package (SOIC) 14S1 REV. A ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 26. Errata The revision letters in this section refer to the revision of the corresponding ATtiny24/44/84 device. 26.1 26.1.1 ATtiny24 Rev. D - E No known errata. 26.1.2 Rev. C * Reading EEPROM when system clock frequency is below 900 kHz may not work 1. Reading EEPROM when system clock frequency is below 900 kHz may not work Reading data from the EEPROM at system clock frequency below 900 kHz may result in wrong data read. Problem Fix/Work around Avoid using the EEPROM at clock frequency below 900 kHz. 26.1.3 Rev. B * EEPROM read from application code does not work in Lock Bit Mode 3 * Reading EEPROM when system clock frequency is below 900 kHz may not work 1. EEPROM read from application code does not work in Lock Bit Mode 3 When the Memory Lock Bits LB2 and LB1 are programmed to mode 3, EEPROM read does not work from the application code. Problem Fix/Work around Do not set Lock Bit Protection Mode 3 when the application code needs to read from EEPROM. 2. Reading EEPROM when system clock frequency is below 900 kHz may not work Reading data from the EEPROM at system clock frequency below 900 kHz may result in wrong data read. Problem Fix/Work around Avoid using the EEPROM at clock frequency below 900 kHz. 26.1.4 Rev. A Not sampled. 223 8006K-AVR-10/10 26.2 26.2.1 ATtiny44 Rev. B - D No known errata. 26.2.2 Rev. A * Reading EEPROM when system clock frequency is below 900 kHz may not work 1. Reading EEPROM when system clock frequency is below 900 kHz may not work Reading data from the EEPROM at system clock frequency below 900 kHz may result in wrong data read. Problem Fix/Work around Avoid using the EEPROM at clock frequency below 900 kHz. 224 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 26.3 26.3.1 ATtiny84 Rev. A - B No known errata. 225 8006K-AVR-10/10 27. Datasheet Revision History 27.1 Rev K. - 10/10 1. Added note for Internal 1.1V Reference in Table 16-4 on page 146. 2. Added tape & reel in Section 24. "Ordering Information" on page 217. 3. Updated last page. 27.2 Rev J. - 08/10 1. Updated Section 6.4 "Clock Output Buffer" on page 30, changed CLKO to CKOUT. 2. Removed text "Not recommended for new design" from cover page. 27.3 Rev I. - 06/10 1. Removed "Preliminary" from cover page. 2. Updated notes in Table 19-16, "High-voltage Serial Programming Instruction Set for ATtiny24/44/84," on page 171. 3. Added clarification before Table 6-8, "Capacitance for the Low-Frequency Crystal Oscillator," on page 28. 4. Updated some table notes in Section 20. "Electrical Characteristics" on page 174. 27.4 Rev H. 10/09 1. Updated document template. Re-arranged some sections. 2. Updated "Low-Frequency Crystal Oscillator" with the Table 6-8 on page 28 3. Updated Tables: - "Active Clock Domains and Wake-up Sources in Different Sleep Modes" on page 33 - "DC Characteristics" on page 174 - "Register Summary" on page 213 4. Updated Register Description: - "ADMUX - ADC Multiplexer Selection Register" on page 145 5. Signature Imprint Reading Instructions updated in "Reading Device Signature Imprint Table from Firmware" on page 156. 6. Updated Section: - Step 1. on page 164 7. Added Table: - "Analog Comparator Characteristics" on page 179 8. Updated Figure: - "Active Supply Current vs. frequency (1 - 20 MHz)" on page 187 9. Updated Figure 21-30 on page 201 and Figure 21-33 on page 202 under "Pin Threshold and Hysteresis". 10. Changed ATtiny24/44 device status to "Not Recommended for New Designs. Use: ATtiny24A/44A". 27.5 Rev G. 01/08 1. Updated sections: - "Features" on page 1 226 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 - "RESET" on page 3 - "Overview" on page 4 - "About" on page 6 - "SPH and SPL -- Stack Pointer Register" on page 11 - "Atomic Byte Programming" on page 17 - "Write" on page 17 - "Clock Sources" on page 25 - "Default Clock Source" on page 30 - "Sleep Modes" on page 33 - "Software BOD Disable" on page 34 - "External Interrupts" on page 49 - "USIBR - USI Data Buffer" on page 125 - "USIDR - USI Data Register" on page 124 - "DIDR0 - Digital Input Disable Register 0" on page 131 - "Features" on page 132 - "Prescaling and Conversion Timing" on page 135 - "Temperature Measurement" on page 144 - "ADMUX - ADC Multiplexer Selection Register" on page 145 - "Limitations of debugWIRE" on page 152 - "Reading Lock, Fuse and Signature Data from Software" on page 155 - "Device Signature Imprint Table" on page 161 - "Enter High-voltage Serial Programming Mode" on page 168 - "Absolute Maximum Ratings*" on page 174 - "DC Characteristics" on page 174 - "Speed" on page 175 - "Clock Characteristics" on page 176 - "Accuracy of Calibrated Internal RC Oscillator" on page 176 - "System and Reset Characteristics" on page 177 - "Supply Current of I/O Modules" on page 185 - "ATtiny24" on page 223 - "ATtiny44" on page 224 - "ATtiny84" on page 225 2. Updated bit definitions in sections: - "MCUCR - MCU Control Register" on page 36 - "MCUCR - MCU Control Register" on page 51 - "MCUCR - MCU Control Register" on page 67 - "PINA - Port A Input Pins" on page 68 - "SPMCSR - Store Program Memory Control and Status Register" on page 157 - "Register Summary" on page 213 3. Updated Figures: - "Reset Logic" on page 39 227 8006K-AVR-10/10 - "Watchdog Reset During Operation" on page 42 - "Compare Match Output Unit, Schematic (non-PWM Mode)" on page 95 - "Analog to Digital Converter Block Schematic" on page 133 - "ADC Timing Diagram, Free Running Conversion" on page 137 - "Analog Input Circuitry" on page 140 - "High-voltage Serial Programming" on page 167 - "Serial Programming Timing" on page 183 - "High-voltage Serial Programming Timing" on page 184 - "Active Supply Current vs. Low Frequency (0.1 - 1.0 MHz)" on page 186 - "Active Supply Current vs. frequency (1 - 20 MHz)" on page 187 - "Active Supply Current vs. VCC (Internal RC Oscillator, 8 MHz)" on page 187 - "Active Supply Current vs. VCC (Internal RC Oscillator, 1 MHz)" on page 188 - "Active Supply Current vs. VCC (Internal RC Oscillator, 128 kHz)" on page 188 - "Idle Supply Current vs. Low Frequency (0.1 - 1.0 MHz)" on page 189 - "Idle Supply Current vs. Frequency (1 - 20 MHz)" on page 189 - "Idle Supply Current vs. VCC (Internal RC Oscillator, 8 MHz)" on page 190 - "Idle Supply Current vs. VCC (Internal RC Oscillator, 1 MHz)" on page 190 - "Idle Supply Current vs. VCC (Internal RC Oscillator, 128 kHz)" on page 191 - "Power-down Supply Current vs. VCC (Watchdog Timer Disabled)" on page 191 - "Power-down Supply Current vs. VCC (Watchdog Timer Enabled)" on page 192 - "Reset Pin Input Hysteresis vs. VCC" on page 202 - "Reset Pin Input Hysteresis vs. VCC (Reset Pin Used as I/O)" on page 203 - "Watchdog Oscillator Frequency vs. VCC" on page 205 - "Watchdog Oscillator Frequency vs. Temperature" on page 205 - "Calibrated 8 MHz RC Oscillator Frequency vs. VCC" on page 206 - "Calibrated 8 MHz RC oscillator Frequency vs. Temperature" on page 206 - "ADC Current vs. VCC" on page 207 - "Programming Current vs. VCC (ATtiny24)" on page 209 - "Programming Current vs. VCC (ATtiny44)" on page 209 - "Programming Current vs. VCC (ATtiny84)" on page 210 4. Added Figures: - "Reset Pin Output Voltage vs. Sink Current (VCC = 3V)" on page 198 - "Reset Pin Output Voltage vs. Sink Current (VCC = 5V)" on page 198 - "Reset Pin Output Voltage vs. Source Current (VCC = 3V)" on page 199 - "Reset Pin Output Voltage vs. Source Current (VCC = 5V)" on page 199 5. Updated Tables: - "Device Clocking Options Select" on page 25 - "Start-up Times for the Crystal Oscillator Clock Selection" on page 29 - "Start-up Times for the Internal Calibrated RC Oscillator Clock Selection" on page 27 - "Start-up Times for the External Clock Selection" on page 26 - "Start-up Times for the 128 kHz Internal Oscillator" on page 27 228 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 - "Active Clock Domains and Wake-up Sources in Different Sleep Modes" on page 33 - "Watchdog Timer Prescale Select" on page 47 - "Reset and Interrupt Vectors" on page 48 - "Overriding Signals for Alternate Functions in PA7:PA5" on page 63 - "Overriding Signals for Alternate Functions in PA4:PA2" on page 64 - "Overriding Signals for Alternate Functions in PA1:PA0" on page 64 - "Port B Pins Alternate Functions" on page 65 - "Overriding Signals for Alternate Functions in PB3:PB2" on page 66 - "Overriding Signals for Alternate Functions in PB1:PB0" on page 67 - "Waveform Generation Modes" on page 110 - "ADC Conversion Time" on page 138 - "Temperature vs. Sensor Output Voltage (Typical Case)" on page 144 - "DC Characteristics. TA = -40C to +85C" on page 174 - "Calibration Accuracy of Internal RC Oscillator" on page 176 - "Reset, Brown-out, and Internal Voltage Characteristics" on page 177 - "VBOT vs. BODLEVEL Fuse Coding" on page 179 - "ADC Characteristics, Single Ended Channels. T = -40C to +85C" on page 180 - "ADC Characteristics, Differential Channels (Bipolar Mode), TA = -40C to +85C" on page 182 - "Serial Programming Characteristics, TA = -40C to +85C, VCC = 1.8 - 5.5V (Unless Otherwise Noted)" on page 183 - "High-voltage Serial Programming Characteristics TA = 25C, VCC = 5V (Unless otherwise noted)" on page 184 6. Updated code examples in sections: - "Write" on page 17 - "SPI Master Operation Example" on page 119 7. Updated "Ordering Information" in: - "ATtiny84" on page 219 27.6 Rev F. 02/07 1. 2. 3. 4. 5. 6. 7. 8. 9. Updated Figure 1-1 on page 2, Figure 8-7 on page 43, Figure 20-6 on page 184. Updated Table 9-1 on page 48, Table 10-7 on page 65, Table 11-2 on page 80, Table 11-3 on page 81, Table 11-5 on page 81, Table 11-6 on page 82, Table 11-7 on page 82, Table 11-8 on page 83, Table 20-11 on page 182, Table 20-13 on page 184. Updated table references in "TCCR0A - Timer/Counter Control Register A" on page 80. Updated Port B, Bit 0 functions in "Alternate Functions of Port B" on page 65. Updated WDTCR bit name to WDTCSR in assembly code examples. Updated bit5 name in "TIFR1 - Timer/Counter Interrupt Flag Register 1" on page 114. Updated bit5 in "TIFR1 - Timer/Counter Interrupt Flag Register 1" on page 114. Updated "SPI Master Operation Example" on page 119. Updated step 5 in "Enter High-voltage Serial Programming Mode" on page 168. 229 8006K-AVR-10/10 27.7 Rev E. 09/06 1. 2. 3. 4. 27.8 27.9 5. 6. 7. 8. 9. 10. All characterization data moved to "Electrical Characteristics" on page 174. All Register Descriptions gathered up in separate sections at the end of each chapter. Updated "System Control and Reset" on page 39. Updated Table 11-3 on page 81, Table 11-6 on page 82, Table 11-8 on page 83, Table 12-3 on page 109 and Table 12-5 on page 110. Updated "Fast PWM Mode" on page 97. Updated Figure 12-7 on page 98 and Figure 16-1 on page 133. Updated "Analog Comparator Multiplexed Input" on page 129. Added note in Table 19-12 on page 165. Updated "Electrical Characteristics" on page 174. Updated "Typical Characteristics" on page 185. 1. 2. 3. 4. 5. 6. Updated "Calibrated Internal 8 MHz Oscillator" on page 26. Updated "OSCCAL - Oscillator Calibration Register" on page 30. Added Table 20-2 on page 176. Updated code examples in "SPI Master Operation Example" on page 119. Updated code examples in "SPI Slave Operation Example" on page 121. Updated "Signature Bytes" on page 162. 1. 2. 3. 4. Updated Features in "USI - Universal Serial Interface" on page 117. Added "Clock speed considerations" on page 123. Updated Bit description in "ADMUX - ADC Multiplexer Selection Register" on page 145. Added note to Table 18-1 on page 157. 1. 2. 3. Updated "Default Clock Source" on page 30 Updated "Power Reduction Register" on page 35. Updated Table 20-4 on page 177, Table 9-4 on page 42, Table 16-3 on page 145, Table 19-5 on page 161, Table 19-12 on page 165, Table 19-16 on page 171, Table 2011 on page 182. Updated Features in "Analog to Digital Converter" on page 132. Updated Operation in "Analog to Digital Converter" on page 132. Updated "Temperature Measurement" on page 144. Updated DC Characteristics in "Electrical Characteristics" on page 174. Updated "Typical Characteristics" on page 185. Updated "Errata" on page 223. Rev D. 08/06 Rev C. 07/06 27.10 Rev B. 05/06 4. 5. 6. 7. 8. 9. 27.11 Rev A. 12/05 Initial revision. 230 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 Table of Contents Features ..................................................................................................... 1 1 Pin Configurations ................................................................................... 2 1.1 Pin Descriptions .................................................................................................2 2 Overview ................................................................................................... 4 3 About ......................................................................................................... 6 4 5 6 7 3.1 Resources .........................................................................................................6 3.2 Code Examples .................................................................................................6 3.3 Data Retention ...................................................................................................6 3.4 Disclaimer ..........................................................................................................6 CPU Core .................................................................................................. 7 4.1 Architectural Overview .......................................................................................7 4.2 ALU - Arithmetic Logic Unit ...............................................................................8 4.3 Status Register ..................................................................................................8 4.4 General Purpose Register File ........................................................................10 4.5 Stack Pointer ...................................................................................................11 4.6 Instruction Execution Timing ...........................................................................12 4.7 Reset and Interrupt Handling ...........................................................................12 Memories ................................................................................................ 15 5.1 In-System Re-programmable Flash Program Memory ....................................15 5.2 SRAM Data Memory ........................................................................................15 5.3 EEPROM Data Memory ..................................................................................16 5.4 I/O Memory ......................................................................................................20 5.5 Register Description ........................................................................................20 Clock System ......................................................................................... 24 6.1 Clock Subsystems ...........................................................................................24 6.2 Clock Sources .................................................................................................25 6.3 System Clock Prescaler ..................................................................................30 6.4 Clock Output Buffer .........................................................................................30 6.5 Register Description ........................................................................................30 Power Management and Sleep Modes ................................................. 33 7.1 Sleep Modes ....................................................................................................33 7.2 Software BOD Disable .....................................................................................34 i 8006K-AVR-10/10 8 9 7.3 Power Reduction Register ...............................................................................35 7.4 Minimizing Power Consumption ......................................................................35 7.5 Register Description ........................................................................................36 System Control and Reset .................................................................... 39 8.1 Resetting the AVR ...........................................................................................39 8.2 Reset Sources .................................................................................................40 8.3 Internal Voltage Reference ..............................................................................42 8.4 Watchdog Timer ..............................................................................................42 8.5 Register Description ........................................................................................45 Interrupts ................................................................................................ 48 9.1 Interrupt Vectors ..............................................................................................48 9.2 External Interrupts ...........................................................................................49 9.3 Register Description ........................................................................................51 10 I/O Ports .................................................................................................. 54 10.1 Ports as General Digital I/O .............................................................................55 10.2 Alternate Port Functions ..................................................................................58 10.3 Register Description ........................................................................................67 11 8-bit Timer/Counter0 with PWM ............................................................ 69 11.1 Features ..........................................................................................................69 11.2 Overview ..........................................................................................................69 11.3 Clock Sources .................................................................................................70 11.4 Counter Unit ....................................................................................................70 11.5 Output Compare Unit .......................................................................................71 11.6 Compare Match Output Unit ............................................................................73 11.7 Modes of Operation .........................................................................................74 11.8 Timer/Counter Timing Diagrams .....................................................................78 11.9 Register Description ........................................................................................80 12 16-bit Timer/Counter1 ............................................................................ 87 ii 12.1 Features ..........................................................................................................87 12.2 Overview ..........................................................................................................87 12.3 Timer/Counter Clock Sources .........................................................................89 12.4 Counter Unit ....................................................................................................89 12.5 Input Capture Unit ...........................................................................................90 12.6 Output Compare Units .....................................................................................92 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 12.7 Compare Match Output Unit ............................................................................94 12.8 Modes of Operation .........................................................................................96 12.9 Timer/Counter Timing Diagrams ...................................................................103 12.10 Accessing 16-bit Registers ............................................................................105 12.11 Register Description ......................................................................................108 13 Timer/Counter Prescaler ..................................................................... 115 13.1 Prescaler Reset .............................................................................................115 13.2 External Clock Source ...................................................................................115 13.3 Register Description ......................................................................................116 14 USI - Universal Serial Interface .......................................................... 117 14.1 Features ........................................................................................................117 14.2 Overview ........................................................................................................117 14.3 Functional Descriptions .................................................................................118 14.4 Alternative USI Usage ...................................................................................124 14.5 Register Descriptions ....................................................................................124 15 Analog Comparator ............................................................................. 129 15.1 Analog Comparator Multiplexed Input ...........................................................129 15.2 Register Description ......................................................................................130 16 Analog to Digital Converter ................................................................ 132 16.1 Features ........................................................................................................132 16.2 Overview ........................................................................................................132 16.3 Operation .......................................................................................................133 16.4 Starting a Conversion ....................................................................................134 16.5 Prescaling and Conversion Timing ................................................................135 16.6 Changing Channel or Reference Selection ...................................................138 16.7 ADC Noise Canceler .....................................................................................139 16.8 Analog Input Circuitry ....................................................................................139 16.9 Noise Canceling Techniques .........................................................................140 16.10 ADC Accuracy Definitions .............................................................................140 16.11 ADC Conversion Result .................................................................................143 16.12 Temperature Measurement ...........................................................................144 16.13 Register Description ......................................................................................145 17 debugWIRE On-chip Debug System .................................................. 151 17.1 Features ........................................................................................................151 iii 8006K-AVR-10/10 17.2 Overview ........................................................................................................151 17.3 Physical Interface ..........................................................................................151 17.4 Software Break Points ...................................................................................152 17.5 Limitations of debugWIRE .............................................................................152 17.6 Register Description ......................................................................................152 18 Self-Programming the Flash ............................................................... 153 18.1 Performing Page Erase by SPM ....................................................................153 18.2 Filling the Temporary Buffer (Page Loading) .................................................153 18.3 Performing a Page Write ...............................................................................154 18.4 Addressing the Flash During Self-Programming ...........................................154 18.5 EEPROM Write Prevents Writing to SPMCSR ..............................................155 18.6 Reading Lock, Fuse and Signature Data from Software ...............................155 18.7 Preventing Flash Corruption ..........................................................................157 18.8 Programming Time for Flash when Using SPM ............................................157 18.9 Register Description ......................................................................................157 19 Memory Programming ......................................................................... 159 19.1 Program And Data Memory Lock Bits ...........................................................159 19.2 Fuse Bytes .....................................................................................................160 19.3 Device Signature Imprint Table .....................................................................161 19.4 Page Size ......................................................................................................162 19.5 Serial Programming .......................................................................................163 19.6 High-voltage Serial Programming ..................................................................167 19.7 High-Voltage Serial Programming Algorithm .................................................168 20 Electrical Characteristics .................................................................... 174 20.1 Absolute Maximum Ratings* .........................................................................174 20.2 DC Characteristics .........................................................................................174 20.3 Speed ............................................................................................................175 20.4 Clock Characteristics .....................................................................................176 20.5 System and Reset Characteristics ................................................................177 20.6 Analog Comparator Characteristics ...............................................................179 20.7 ADC Characteristics ......................................................................................180 20.8 Serial Programming Characteristics ..............................................................183 20.9 High-Voltage Serial Programming Characteristics ........................................184 21 Typical Characteristics ........................................................................ 185 21.1 iv Supply Current of I/O Modules ......................................................................185 ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 21.2 Active Supply Current ....................................................................................186 21.3 Idle Supply Current ........................................................................................189 21.4 Power-down Supply Current ..........................................................................191 21.5 Standby Supply Current ................................................................................192 21.6 Pin Pull-up .....................................................................................................193 21.7 Pin Driver Strength ........................................................................................196 21.8 Pin Threshold and Hysteresis ........................................................................200 21.9 BOD Threshold and Analog Comparator Offset ............................................203 21.10 Internal Oscillator Speed ...............................................................................205 21.11 Current Consumption of Peripheral Units ......................................................207 21.12 Current Consumption in Reset and Reset Pulsewidth ..................................211 22 Register Summary ............................................................................... 213 23 Instruction Set Summary .................................................................... 215 24 Ordering Information ........................................................................... 217 24.1 ATtiny24 ........................................................................................................217 24.2 ATtiny44 ........................................................................................................218 24.3 ATtiny84 ........................................................................................................219 25 Packaging Information ........................................................................ 220 25.1 20M1 ..............................................................................................................220 25.2 14P3 ..............................................................................................................221 25.3 14S1 ..............................................................................................................222 26 Errata ..................................................................................................... 223 26.1 ATtiny24 ........................................................................................................223 26.2 ATtiny44 ........................................................................................................224 26.3 ATtiny84 ........................................................................................................225 27 Datasheet Revision History ................................................................ 226 27.1 Rev K. - 10/10 ................................................................................................226 27.2 Rev J. - 08/10 ................................................................................................226 27.3 Rev I. - 06/10 .................................................................................................226 27.4 Rev H. 10/09 ..................................................................................................226 27.5 Rev G. 01/08 .................................................................................................226 27.6 Rev F. 02/07 ..................................................................................................229 27.7 Rev E. 09/06 ..................................................................................................230 27.8 Rev D. 08/06 ..................................................................................................230 v 8006K-AVR-10/10 27.9 Rev C. 07/06 ..................................................................................................230 27.10 Rev B. 05/06 ..................................................................................................230 27.11 Rev A. 12/05 ..................................................................................................230 Table of Contents....................................................................................... i vi ATtiny24/44/84 8006K-AVR-10/10 ATtiny24/44/84 vii 8006K-AVR-10/10 Headquarters International Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131 USA Tel: (+1)(408) 441-0311 Fax: (+1)(408) 487-2600 Atmel Asia Limited Unit 01-5 & 16, 19F BEA Tower, Millennium City 5 418 Kwun Tong Road Kwun Tong, Kowloon HONG KONG Tel: (+852) 2245-6100 Fax: (+852) 2722-1369 Atmel Munich GmbH Business Campus Parkring 4 D-85748 Garching b. Munich GERMANY Tel: (+49) 89-31970-0 Fax: (+49) 89-3194621 Atmel Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 JAPAN Tel: (+81)(3) 3523-3551 Fax: (+81)(3) 3523-7581 Technical Support avr@atmel.com Sales Contact www.atmel.com/contacts Product Contact Web Site www.atmel.com Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL'S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL'S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel's products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. (c) 2010 Atmel Corporation. All rights reserved. Atmel(R), logo and combinations thereof, and others are registered trademarks or trademarks of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. 8006K-AVR-10/10