![Atmel AT90S8414 Manual Download Page 24](http://html1.mh-extra.com/html/atmel/at90s8414/at90s8414_manual_3003427024.webp)
4-24
AT90S8414
Preliminary
THE STACK POINTER - SP
The general
AVR
16-bit Stack Pointer is effectively built up of two 8-bit registers in the I/O space locations $3E and
$3D. Since the stack address space is within the data SRAM, a 9 bit stack pointer is used to address the stack in the
AT90S8414.
Bit
15
14
13
12
11
10
9
8
$3E
-
-
-
-
-
-
-
SP8
SPH
$3D
SP7
SP6
SP5
SP4
SP3
SP2
SP1
SP0
SPL
7
6
5
4
3
2
1
0
Read/Write
R
R
R
R
R
R
R
R/W
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
0
0
0
0
0
0
0
0
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 is decremented by one when data is pushed onto the Stack with the PUSH instruction, and it
is decremented by two when data is pushed onto the Stack with subroutine CALL and 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 IRET.
Reset and Interrupt Handling
The AT90S8414 provides 13 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
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 is the priority level. RESET has the highest priority, and next is INT0 - the External
Interrupt Request 0 etc.
Table 2: Reset and Interrupt Vectors
Vector No.
Program Address
Source
Interrupt Definition
1
$000
RESET
Hardware Pin and Watchdog Reset
2
$001
INT0
External Interrupt Request 0
3
$002
INT1
External Interrupt Request 1
4
$003
TIMER1 CAPT
Timer/Counter1 Capture Event
5
$004
TIMER1 COMPA
Timer/Counter1 Compare Match A
6
$005
TIMER1 COMPB
Timer/Counter1 Compare Match B
7
$006
TIMER1 OVF
Timer/Counter1 Overflow
8
$007
TIMER0, COMP
Timer/Counter0 Compare Match
9
$008
TIMER0, OVF
Timer/Counter0 Overflow
10
$009
SPI, STC
Serial Transfer Complete
11
$00A
UART, RX
UART, Rx Complete
12
$00B
UART, UDRE
UART Data Register Empty
13
$00C
UART, TX
UART, Tx Complete
14
$00D
ANA_COMP
Analog Comparator
The most typical and general program setup for the Reset and Interrupt Vector Addresses are: