Reset And Interrupt Handling - Atmel AVR ATtiny22 Preliminary Data Sheet

Microcontroller with 2k bytes of in-system programmable flash
Table of Contents

Advertisement

Reset and Interrupt Handling

The ATtiny22/L provides two interrupt sources. These interrupts and the separate reset vector, each have a separate
program vector in the program memory space. Both interrupts are assigned individual enable bits which must be set (one)
together with the I-bit in the status register in order to enable the interrupt.
The lowest addresses in the program memory space are automatically defined as the Reset and Interrupt vectors. The
complete list of vectors is shown in Table 2 . The list also determines the priority levels of the interrupts. The lower the
address the higher is the priority level. RESET has the highest priority, next is INT0 - the External Interrupt Request 0, etc.
Table 2. Reset and Interrupt Vectors
Vector No.
Program Address
1
2
3
The most typical program setup for the Reset and Interrupt Vector Addresses are:
Address
$000
$001
$002
$003
...
Reset Sources
The ATtiny22/L provides three sources of reset:
• Power-On Reset. The MCU is reset when the supply voltage is below the power-on reset threshold (V
• External Reset. The MCU is reset when a low level is present on the RESET pin for more than 50 ns.
• Watchdog Reset. The MCU is reset when the Watchdog timer period expires and the Watchdog is enabled.
During reset, all I/O registers are set to their initial values, and the program starts execution from address $000. The
instruction placed in address $000 must be an RJMP - relative jump - instruction to the reset handling routine. If the
program never enables an interrupt source, the interrupt vectors are not used, and regular program code can be placed at
these locations. The circuit diagram in Figure 22 shows the reset logic. Table 3 defines the timing and electrical parameters
of the reset circuitry.
ATtiny22/22L
18
Source
$000
RESET
$001
INT0
$002
TIMER0, OVF0
Labels
Code
rjmp RESET
rjmp EXT_INT0
rjmp TIM_OVF0
MAIN:
ldi r16, low(RAMEND)
out SPL, r16
<instr> xxx
...
...
Interrupt Definition
Hardware Pin, Power-on Reset and Watchdog Reset
External Interrupt Request 0
Timer/Counter0 Overflow
Comments
; Reset Handler
; IRQ0 Handler
; Timer0 Overflow Handler;
; Main program start
...
).
POT

Advertisement

Table of Contents
loading

This manual is also suitable for:

Avr attiny22l

Table of Contents