14.1 Interrupt Vectors in ATmega324PB

Table 14-1. Reset and Interrupt Vectors in ATmega324PB
Vector NoProgram Address(2)SourceInterrupts definition
10x0000(1)RESETExternal Pin, Power-on Reset, Brown-out Reset and Watchdog System Reset
20x0002INT0External Interrupt Request 0
30x0004INT1External Interrupt Request 1
40x0006INT2External Interrupt Request 2
50x0008PCINT0Pin Change Interrupt Request 0
60x000APCINT1Pin Change Interrupt Request 1
70x000CPCINT2Pin Change Interrupt Request 2
80x000EPCINT3Pin Change Interrupt Request 3
90x0010WDTWatchdog Time-out Interrupt
100x0012TIMER2_COMPATimer/Counter2 Compare Match A
110x0014TIMER2_COMPBTimer/Coutner2 Compare Match B
120x0016TIMER2_OVFTimer/Counter2 Overflow
130x0018TIMER1_CAPTTimer/Counter1 Capture Event
140x001ATIMER1_COMPATimer/Counter1 Compare Match A
150x001CTIMER1_COMPBTimer/Coutner1 Compare Match B
160x001ETIMER1_OVFTimer/Counter1 Overflow
170x0020TIMER0_COMPATimer/Counter0 Compare Match A
180x0022TIMER0_COMPBTimer/Coutner0 Compare Match B
190x0024TIMER0_OVFTimer/Counter0 Overflow
200x0026SPI0_STCSPI0 Serial Transfer Complete
210x0028USART0_RXUSART0 Rx Complete
220x002AUSART0_UDREUSART0, Data Register Empty
230x002CUSART0_TXUSART0, Tx Complete
240x002EANALOG_COMPAnalog Comparator
250x0030ADCADC Conversion Complete
260x0032EE_READYEEPROM Ready
270x0034TWI0TWI0 Transfer complete
280x0036SPM_READYStore Program Memory Ready
290x0038USART1_RXUSART1 Rx Complete
300x003AUSART1_UDREUSART1, Data Register Empty
310x003CUSART1_TXUSART0, Tx Complete
320x003ETIMER3_CAPTTimer/Counter3 Capture Event
330x0040TIMER3_COMPATimer/Counter3 Compare Match A
340x0042TIMER3_COMPBTimer/Coutner3 Compare Match B
350x0044TIMER3_OVFTimer/Counter3 Overflow
360x0046USART0_STARTUSART0 Start Frame detection
370x0048USART1_STARTUSART1 Start Frame detection
380x004APCINT4Pin Change Interrupt 4
390x004CCFDCrystal Failure Detection
400x004EPTC_EOCPTC End of Conversion
410x0050PTC_WCOMPPTC Window comparator mode
420x0052SPI1_STCSPI1 Serial Transfer Complete
430x0054TWI1TWI1 Transfer complete
440x0056TIMER4_CAPTTimer/Counter4 Capture Event
450x0058TIMER4_COMPATimer/Counter4 Compare Match A
460x005ATIMER4_COMPBTimer/Coutner4 Compare Match B
470x005CTIMER4_OVFTimer/Counter4 Overflow
480x005EUSART2_RXUSART2 Rx Complete
490x0060USART2_UDREUSART2, Data Register Empty
500x0062USART2_TXUSART2, Tx Complete
510x0064USART2_STARTUSART2 Start Frame detection
Note:
  1. When the BOOTRST Fuse is programmed, the device will jump to the Boot Loader address at reset, see Memory programming
  2. When the IVSEL bit in MCUCR is set, Interrupt Vectors will be moved to the start of the Boot Flash Section. The address of each Interrupt Vector will then be the address in this table added to the start address of the Boot Flash Section.

The table below shows reset and Interrupt Vectors placement for the various combinations of BOOTRST and IVSEL settings. If the program never enables an interrupt source, the Interrupt Vectors are not used, and regular program code can be placed at these locations. This is also the case if the Reset Vector is in the Application section while the Interrupt Vectors are in the Boot section or vice versa.

Table 14-2. Reset and Interrupt Vectors placement
BOOTRSTIVSELReset AddressInterrupt Vectors Start Address
100x00000x0002
110x0000Boot Reset Address + 0x0002
00Boot Reset Address0x0002
01Boot Reset AddressBoot Reset Address + 0x0002
Note: The Boot Reset Address is shown in Table Boot size configuration in Boot Loader Parameters. For the BOOTRST Fuse “1” means unprogrammed while “0” means programmed.
When the BOOTRST Fuse is unprogrammed, 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     Code                    Comments
0x00000    RESET:     ldi r16,high(RAMEND)    ; Main program start
0x00001               out SPH,r16             ; Set Stack Pointer to top of RAM
0x00002               ldi r16,low(RAMEND)
0x00003               out SPL,r16
0x00004               sei                     ; Enable interrupts
0x00005               <instr>            xxx
;
.org 0x1F002
0x1F002               jmp EXT_INT0            ; IRQ0 Handler
0x1F004               jmp EXT_INT1            ; IRQ1 Handler
...        ...         ...                    ;
0x1FO36               jmp SPM_RDY             ; SPM Ready Handler
When the BOOTRST Fuse is programmed and the Boot section size set to 8K bytes, the most typical and general program setup for the Reset and Interrupt Vector Addresses is:
Address    Labels     Code                     Comments
.org 0x0002
0x00002               jmp EXT_INT0            ; IRQ0 Handler
0x00004               jmp EXT_INT1            ; IRQ1 Handler
...          ...      ...                     ;
0x00036               jmp SPM_RDY             ; SPM Ready Handler
;
.org       0x1F000
0x1F000    RESET:     ldi r16,high(RAMEND)    ; Main program start
0x1F001               out SPH,r16             ; Set Stack Pointer to top of RAM
0x1F002               ldi r16,low(RAMEND)
0x1F003               out SPL,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      Code                     Comments
;
.org 0x1F000
0x1F000                jmp RESET               ; Reset handler
0x1F002                jmp EXT_INT0            ; IRQ0 Handler
0x1F004                jmp EXT_INT1            ; IRQ1 Handler
...        ...         ...                     ;
0x1F036                jmp SPM_RDY             ; SPM Ready Handler
;
0x1F03E    RESET:      ldi r16,high(RAMEND)    ; Main program start
0x1F03F                out SPH,r16             ; Set Stack Pointer to top of RAM
0x1F040                ldi r16,low(RAMEND)
0x1F041                out SPL,r16
0x1F042                sei                     ; Enable interrupts
0x1FO43                <instr> xxx