![](/user_photo/2706_HbeT2.jpg)
- •Features
- •Pin Configuration
- •Overview
- •ATtiny11 Block Diagram
- •ATtiny12 Block Diagram
- •Pin Descriptions
- •Port B (PB5..PB0)
- •XTAL1
- •XTAL2
- •RESET
- •Status Register
- •Internal RC Oscillator
- •Crystal Oscillator
- •External Clock
- •External RC Oscillator
- •Register Description
- •Memories
- •I/O Memory
- •Register Indirect
- •I/O Direct
- •Flash Program Memory
- •EEPROM Data Memory
- •Register Description
- •Sleep Modes
- •Sleep Modes for the ATtiny11
- •Idle Mode
- •Power-down Mode
- •Sleep Modes for the ATtiny12
- •Idle Mode
- •Power-down Mode
- •Reset Sources
- •External Reset
- •Watchdog Reset
- •Register Description
- •Interrupts
- •Reset and Interrupt
- •Interrupt Handling
- •Interrupt Response Time
- •External Interrupt
- •Pin Change Interrupt
- •Register Description
- •I/O Port B
- •Register Description
- •Port B as General Digital I/O
- •Alternate Functions of Port B
- •Timer/Counter0
- •Timer/Counter Prescaler
- •Register Description
- •Watchdog Timer
- •Register Description
- •Analog Comparator
- •Register Description
- •Fuse Bits in ATtiny11
- •Fuse Bits in ATtiny12
- •Signature Bytes
- •ATtiny11
- •ATtiny12
- •ATtiny11/12
- •High-voltage Serial Programming
- •Low-voltage Serial Downloading (ATtiny12 only)
- •Data Polling
- •Electrical Characteristics
- •Absolute Maximum Ratings
- •External Clock Drive ATtiny11
- •External Clock Drive ATtiny12
- •Register Summary ATtiny11
- •Register Summary ATtiny12
- •Instruction Set Summary
- •Ordering Information
- •ATtiny11
- •ATtiny12
- •Packaging Information
- •Table of Contents
![](/html/2706/399/html_g5p6GE8000.jJll/htmlconvd-y488uO31x1.jpg)
|
|
|
|
|
|
|
ATtiny11/12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$004 |
|
rjmp |
EE_RDY |
; EEPROM Ready handler |
|
|
|
|
|||||
|
|
$005 |
|
rjmp |
ANA_COMP |
; Analog Comparator handler |
|
|
|
; |
|
|
|
|
|
|
|
$006 |
MAIN: |
<instr> |
xxx |
; Main program start |
|
|
|
… |
… |
… |
… |
|
|
|
Interrupt Handling |
The ATtiny11/12 has two 8-bit Interrupt Mask control registers; GIMSK – General Inter- |
|||||
|
|
rupt Mask register and TIMSK – Timer/Counter Interrupt Mask register. |
When an interrupt occurs, the Global Interrupt Enable I-bit is cleared (zero) and all interrupts are disabled. The user software can set (one) the I-bit to enable nested interrupts. The I-bit is set (one) when a Return from Interrupt instruction – RETI – is executed.
When the Program Counter is vectored to the actual interrupt vector in order to execute the interrupt handling routine, hardware clears the corresponding flag that generated the interrupt. Some of the 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 when the corresponding interrupt enable bit is cleared (zero), the interrupt flag will be set and remembered until the interrupt is enabled, or the flag is cleared by software.
If one or more interrupt conditions occur when the global interrupt enable bit is cleared (zero), the corresponding interrupt flag(s) will be set and remembered until the global interrupt enable bit is set (one), and will be executed by order of priority.
Note that external level interrupt does not have a flag, and will only be remembered for as long as the interrupt condition is active.
Note that the status register is not automatically stored when entering an interrupt routine and restored when returning from an interrupt routine. This must be handled by software.
Interrupt Response Time |
The interrupt execution response for all the enabled AVR interrupts is 4 clock cycles |
|
minimum. After the 4 clock cycles, the program vector address for the actual interrupt |
|
handling routine is executed. During this 4-clock-cycle period, the Program Counter (9 |
|
bits) is pushed onto the Stack. The vector is normally a relative jump to the interrupt rou- |
|
tine, and this jump takes 2 clock cycles. If an interrupt occurs during execution of a |
|
multi-cycle instruction, this instruction is completed before the interrupt is served. In |
|
ATtiny12, if an interrupt occurs when the MCU is in Sleep mode, the interrupt response |
|
time is increased by 4 clock cycles. |
|
A return from an interrupt handling routine takes 4 clock cycles. During these 4 clock |
|
cycles, the Program Counter (9 bits) is popped back from the Stack, and the I-flag in |
|
SREG is set. When AVR exits from an interrupt, it will always return to the main program |
|
and execute one more instruction before any pending interrupt is served. |
External Interrupt |
The external interrupt is triggered by the INT0 pin. Observe that, if enabled, the interrupt |
|
will trigger even if the INT0 pin is configured as an output. This feature provides a way of |
|
generating a software interrupt. The external interrupt can be triggered by a falling or ris- |
|
ing edge, a pin change, or a low level. This is set up as indicated in the specification for |
|
the MCU Control Register – MCUCR. When the external interrupt is enabled and is con- |
|
figured as level triggered, the interrupt will trigger as long as the pin is held low. |
|
The external interrupt is set up as described in the specification for the MCU Control |
|
Register – MCUCR. |
31
1006F–AVR–06/07