Datasheet
ATmega164A/PA/324A/PA/644A/PA/1284/P
2018 Microchip Technology Inc. Data Sheet Complete DS40002070A-page 73
0x1F003 outSPL,r16
0x1F004 sei; Enable interrupts
0x1F005 <instr> xxx
When the BOOTRST Fuse is programmed, the Boot section size set to 8K 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 is:
Address Labels CodeComments
;
.org 0x1F000
0x1F000 jmpRESET; Reset handler
0x1F002 jmpEXT_INT0; IRQ0 Handler
0x1F004 jmpEXT_INT1; IRQ1 Handler
... ......;
0x1F036 jmpSPM_RDY; SPM Ready
Handler
;
0x1F03E RESET: ldir16,high(RAMEND); Main
program start
0x1F03F outSPH,r16; Set Stack
Pointer to top of RAM
0x1F040 ldir16,low(RAMEND)
0x1F041 outSPL,r16
0x1F042 sei; Enable interrupts
0x1FO43 <instr> xxx
12.2.1 Moving Interrupts Between Application and Boot Space
The General Interrupt Control Register controls the placement of the Interrupt Vector table.
12.3 Register description
12.3.1 MCUCR – MCU Control Register
Note: 1. Only available in the ATmega164PA/324PA/644PA/1284P.
• Bit 1 – IVSEL: Interrupt Vector Select
When the IVSEL bit is cleared (zero), the Interrupt Vectors are placed at the start of the Flash memory. When
this bit is set (one), the Interrupt Vectors are moved to the beginning of the Boot Loader section of the Flash.
The actual address of the start of the Boot Flash Section is determined by the BOOTSZ Fuses. Refer to the
section ”Memory programming” on page 295 for details. To avoid unintentional changes of Interrupt Vector
tables, a special write procedure must be followed to change the IVSEL bit:
1. Write the Interrupt Vector Change Enable (IVCE) bit to one.
2. Within four cycles, write the desired value to IVSEL while writing a zero to IVCE.
Interrupts will automatically be disabled while this sequence is executed. Interrupts are disabled in the cycle
IVCE is set, and they remain disabled until after the instruction following the write to IVSEL. If IVSEL is not
Bit 76 5 43210
0x35 (0x55)
JTD BODS
(1)
BODSE
(1)
PUD – – IVSEL IVCE MCUCR
Read/Write R/W R/W R/W R/W R R R/W R/W
Initial Value00 0 00000