atmega323l ATMEL Corporation, atmega323l Datasheet - Page 22
atmega323l
Manufacturer Part Number
atmega323l
Description
Atmega323 8-bit Avr Microcontroller With 32k Bytes Of In-system Programmable Flash
Manufacturer
ATMEL Corporation
Datasheet
1.ATMEGA323L.pdf
(247 pages)
- Current page: 22 of 247
- Download datasheet (4Mb)
The Stack Pointer
Reset and Interrupt
Handling
22
ATmega323(L)
–
SP
The ATmega323 Stack Pointer is implemented as two 8-bit registers in the I/O space
locations $3E ($5E) and $3D ($5D). As the ATmega323 Data memory has $860 loca-
tions, 12 bits are used.
The Stack Pointer points to the data SRAM Stack area where the Subroutine and Inter-
rupt 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 $60. 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 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 RETI.
The ATmega323 provides nineteen 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. Depending
on the Program Counter value, interrupts may be disabled when Boot Lock bits BLB02
or BLB12 are set. See the section “Boot Loader Support” on page 177 for details
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 3. 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
nal Interrupt Request 0, etc. The Interrupt Vectors can be moved to the start of the boot
Flash section by setting the IVSEL bit in the General Interrupt Control Register (GICR).
See the GICR description on page 33 for details..
Table 3. Reset and Interrupt Vectors
Bit
$3E ($5E)
$3D ($5D)
Read/Write
Initial Value
Vector No.
1
2
3
4
5
6
7
8
9
SP7
R/W
Program Address
15
R
–
7
0
0
$000
$00A
$00C
$00E
$002
$004
$006
$008
$010
SP6
R/W
14
R
–
6
0
0
(1)
SP5
R/W
(2)
13
R
–
5
0
0
Source
RESET
INT0
INT1
INT2
TIMER2 COMP
TIMER2 OVF
TIMER1 CAPT
TIMER1 COMPA
TIMER1 COMPB
SP4
R/W
12
R
–
4
0
0
SP11
SP3
R/W
R/W
11
3
0
0
Interrupt Definition
External Pin, Power-on Reset,
Brown-out Reset and Watchdog
Reset
External Interrupt Request 0
External Interrupt Request 1
External Interrupt Request 2
Timer/Counter2 Compare Match
Timer/Counter2 Overflow
Timer/Counter1 Capture Event
Timer/Counter1 Compare Match A
Timer/Counter1 Compare Match B
SP10
SP2
R/W
R/W
10
2
0
0
SP9
SP1
R/W
R/W
9
1
0
0
R/W
SP8
SP0
R/W
1457G–AVR–09/03
8
0
0
0
–
the Exter-
SPH
SPL
Related parts for atmega323l
Image
Part Number
Description
Manufacturer
Datasheet
Request
R
Part Number:
Description:
INTERVAL AND WIPE/WASH WIPER CONTROL IC WITH DELAY
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
Low-Voltage Voice-Switched IC for Hands-Free Operation
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
MONOLITHIC INTEGRATED FEATUREPHONE CIRCUIT
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
AM-FM Receiver IC U4255BM-M
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
Monolithic Integrated Feature Phone Circuit
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
Multistandard Video-IF and Quasi Parallel Sound Processing
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
High-performance EE PLD
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
8-bit Flash Microcontroller
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
2-Wire Serial EEPROM
Manufacturer:
ATMEL Corporation
Datasheet:
Part Number:
Description:
U6046BREAR WINDOW HEATING TIMER / LONG-TERM TIMER
Manufacturer:
ATMEL Corporation
Datasheet: