64
8025I–AVR–02/09
ATmega48P/88P/168P/328P
0x0034
out
SPH,r16
; Set Stack Pointer to top of RAM
0x0035
ldi r16,
low(RAMEND)
0x0036
out SPL,r16
0x0037
sei
; Enable interrupts
0x0038
<instr> xxx
...
... ... ...
When the BOOTRST Fuse is unprogrammed, the Boot section size set to 2K bytes and the
IVSEL bit in the MCUCR Register is set before any interrupts are enabled, the most typical and
general program setup for the Reset and Interrupt Vector Addresses in ATmega168P is:
Address
Labels Code
Comments
0x0000
RESET: ldi
r16,high(RAMEND); Main program start
0x0001
out
SPH,r16
; Set Stack Pointer to top of RAM
0x0002
ldi
r16,low(RAMEND)
0x0003
out
SPL,r16
0x0004
sei
; Enable interrupts
0x0005
<instr> xxx
;
.org 0x1C02
0x1C02
jmp
EXT_INT0
; IRQ0 Handler
0x1C04
jmp
EXT_INT1
; IRQ1 Handler
...
...
...
;
0x1C32
jmp
SPM_RDY
; Store Program Memory Ready Handler
When the BOOTRST Fuse is programmed and the Boot section size set to 2K bytes, the most
typical and general program setup for the Reset and Interrupt Vector Addresses in
ATmega168P is:
Address
Labels Code
Comments
.org 0x0002
0x0002
jmp
EXT_INT0
; IRQ0 Handler
0x0004
jmp
EXT_INT1
; IRQ1 Handler
...
...
...
;
0x0032
jmp
SPM_RDY
; Store Program Memory Ready Handler
;
.org 0x1C00
0x1C00
RESET: ldi
r16,high(RAMEND); Main program start
0x1C01
out
SPH,r16
; Set Stack Pointer to top of RAM
0x1C02
ldi
r16,low(RAMEND)
0x1C03
out
SPL,r16
0x1C04
sei
; Enable interrupts
0x1C05
<instr> xxx
When the BOOTRST Fuse is programmed, the Boot section size set to 2K bytes and the IVSEL
bit in the MCUCR Register is set before any interrupts are enabled, the most typical and general
program setup for the Reset and Interrupt Vector Addresses in ATmega168P is: