Reset and interrupt handling – Rainbow Electronics AT90S2313 User Manual
Page 18

18
AT90S2313
0839I–AVR–06/02
Reset and Interrupt
Handling
The AT90S2313 provides 10 different interrupt sources. These interrupts and the sepa-
rate Reset Vector each have a separate Program Vector in the program memory space.
All the interrupts are assigned individual enable bits that 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 different interrupts. The lower the address, the
higher the priority level. RESET has the highest priority, and next is INT0 (the External
Interrupt Request 0), etc.
The most typical and general program setup for the Reset and Interrupt Vector
addresses are:
Address Labels
Code
Comments
$000
rjmp RESET
; Reset Handler
$001
rjmp EXT_INT0
; IRQ0 Handler
$002
rjmp EXT_INT1
; IRQ1 Handler
$003
rjmp TIM_CAPT1
; Timer1 Capture Handler
$004
rjmp TIM_COMP1
; Timer1 Compare Handler
$005
rjmp TIM_OVF1
; Timer1 Overflow Handler
$006
rjmp TIM_OVF0
; Timer0 Overflow Handler
$007
rjmp UART_RXC
; UART RX Complete Handler
$008
rjmp UART_DRE
; UDR Empty Handler
$009
rjmp UART_TXC
; UART TX Complete Handler
$00a
rjmp ANA_COMP
; Analog Comparator Handler
;
$00b
MAIN:
ldi r16,low(RAMEND); Main program start
$00c
out SPL,r16
$00d
<instr>
xxx
…
…
…
…
Table 2. Reset and Interrupt Vectors
Vector No.
Program Address
Source
Interrupt Definition
1
$000
RESET
Hardware Pin, Power-on Reset and
Watchdog Reset
2
$001
INT0
External Interrupt Request 0
3
$002
INT1
External Interrupt Request 1
4
$003
TIMER1 CAPT1
Timer/Counter1 Capture Event
5
$004
TIMER1 COMP1
Timer/Counter1 Compare Match
6
$005
TIMER1 OVF1
Timer/Counter1 Overflow
7
$006
TIMER0 OVF0
Timer/Counter0 Overflow
8
$007
UART, RX
UART, RX Complete
9
$008
UART, UDRE
UART Data Register Empty
10
$009
UART, TX
UART, TX Complete
11
$00A
ANA_COMP
Analog Comparator