3.4.1 Interrupt Vectors in ATmega165A/PA/325A/PA/3250A/PA/645A/P/6450A/P

A clarification for the source names of the Interrupt Vectors has been made to comply with the header file naming convention.

Table 3-7. Reset and Interrupt Vectors in ATmega165A/PA/325A/PA/645A/P
Vector NoProgram Address(2)SourceInterrupts Definition
10x0000(1)RESETExternal pin, Power-on Reset, Brown-out Reset, Watchdog System Reset and JTAG AVR Reset
20x0002INT0External Interrupt Request 0
30x0004PCINT0Pin Change Interrupt Request 0
40x0006PCINT1Pin Change Interrupt Request 1
50x0008TIMER2_COMPTimer/Counter2 Compare Match
60x000ATIMER2_OVFTimer/Counter2 Overflow
70x000CTIMER1_CAPTTimer/Counter1 Capture Event
80x000ETIMER1_COMPATimer/Counter1 Compare Match A
90x0010TIMER1_COMPBTimer/Coutner1 Compare Match B
100x0012TIMER1_OVFTimer/Counter1 Overflow
110x0014TIMER0_COMPTimer/Counter0 Compare Match
120x0016TIMER0_OVFTimer/Counter0 Overflow
130x0018SPI_STCSPI Serial Transfer Complete
140x001AUSART0_RXUSART Receive complete
150x001CUSART0_UDREUSART Data Register Empty
160x001EUSART0_TXUSART Transmit complete
170x0020USI_STARTUSI Start Condition
180x0022USI_OVERFLOWUSI Overflow
190x0024ANALOG_COMPAnalog Comparator
200x0026ADCADC Conversion complete
210x0028EE_READYEEPROM Ready
220x002ASPM_READYStore Program Memory Ready
Note:
  1. When the BOOTRST fuse is programmed, the device will jump to the boot loader address at Reset. See “Boot Loader Support – Read-While-Write Self-Programming”.
  2. When setting the IVSEL bit in MCUCR, 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 different BOOTRST and IVSEL settings combinations. If the program never enables an interrupt source, the Interrupt Vectors are not used, and regularly 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 3-8. Reset and Interrupt Vectors Placement
BOOTRST(1)IVSELReset AddressInterrupt Vectors Start Address
100x0000x002
110x000Boot Reset Address + 0x0002
00Boot Reset Address0x002
01Boot Reset AddressBoot Reset Address + 0x0002
Note: 1. For the BOOTRST Fuse, “1” means unprogrammed, while “0” means programmed.
The most typical and general program setup for the Reset and Interrupt Vector Addresses are:
Address   Labels    Code                         Comments
0x0000               jmp      RESET               ; Reset Handler
0x0002               jmp      INT0                ; IRQ0 Handler 
0x0004               jmp      PCINT0              ; PCINT0 Handler
0x0006               jmp      PCINT1              ; PCINT1 Handler
0x0008               jmp      TIMER2_COMP         ; Timer2 CompareA Handler
0x000A               jmp      TIMER2_OVF          ; Timer2 Overflow Handler
0x000C               jmp      TIMER1_CAPT         ; Timer1 Capture Handler
0x000E               jmp      TIMER1_COMPA        ; Timer1 CompareA Handler
0x0010               jmp      TIMER1_COMPB        ; Timer1 CompareB Handler
0x0012               jmp      TIMER1_OVF          ; Timer1 Overflow Handler
0x0014               jmp      TIMER0_COMP         ; Timer0 Compare Handler
0x0016               jmp      TIMER0_OVF          ; Timer0 Overflow Handler
0x0018               jmp      SPI_STC             ; SPI Transfer Complete Handler
0x001A               jmp      USART0_RX           ; USART RX Complete Handler
0x001C               jmp      USART0_UDRE         ; USART UDR Empty Handler
0x0020               jmp      USI_START           ; USI Start Condition Handler
0x0022               jmp      USI_UDREOVERFLOW    ; USI Overflow Handler
0x0024               jmp      ANALOG_COMP         ; Analog Comparator Handler
0x0026               jmp      ADC                 ; ADC Conversion Complete Handler
0x0028               jmp      EE_READY            ; EEPROM Ready Handler
0x002A               jmp      SPM_READY           ; SPM Ready Handler
;
0x0034    RESET:     ldi      r16,high(RAMEND)    ; Main program start     
0x0035               out      SPH,r16             ; Set Stack Pointer to top of RAM
0x0036               ldi      r16,low(RAMEND)
0x0037               out      SPL,r16
0x0038               sei                          ; Enable interrupts
0x0039               <instr>  xxx
...       ...        ...                             ...
When the BOOTRST Fuse is unprogrammed, the Boot section size is set to 2 KB, and the MCUCR.IVSEL is set before any interrupts are enabled, the most typical and general program setup for the Reset and Interrupt Vector Addresses are:
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             ; SPM Ready Handler
When the BOOTRST Fuse is programmed and the Boot section size is set to 2 KB, the most typical and general program setup for the Reset and Interrupt Vector Addresses are:
Address   Labels     Code                         Comments
.org 0x0002
0x0002               jmp      EXT_INT0            ; IRQ0 Handler
0x0004               jmp      EXT_INT1            ; IRQ1 Handler
...                  ...      ...                 ;
0x0032               jmp      SPM_RDY             ; SPM 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 is set to 2 KB, and the MCUCR.IVSEL is set before any interrupts are enabled, the most typical and general program setup for the Reset and Interrupt Vector Addresses are:
Address    Labels    Code                         Comments
;
.org 0x1C00
0x1C00               jmp      RESET               ; Reset handler
0x1C02               jmp      EXT_INT0            ; IRQ0 Handler
0x1C04               jmp      EXT_INT1            ; IRQ1 Handler
...                  ...      ...                 ;
0x1C32               jmp      SPM_RDY             ; SPM Ready Handler
;
0x1C34    RESET:     ldi      r16,high(RAMEND)    ; Main program start
0x1C35               out      SPH,r16             ; Set Stack Pointer to top of RAM
0x1C36               ldi      r16,low(RAMEND)
0x1C37               out      SPL,r16
0x1C38               sei                          ; Enable interrupts
0x1C39              <instr>  xxx
Table 3-9. Reset and Interrupt Vectors in ATmega3250A/PA/6450A/P
Vector NoProgram Address(2)SourceInterrupts definition
10x0000(1)RESETExternal pin, Power-on Reset, Brown-out Reset, Watchdog Reset and JTAG AVR Reset.
20x0002INT0External Interrupt Request 0
30x0004PCINT0Pin Change Interrupt Request 0
40x0006PCINT1Pin Change Interrupt Request 1
50x0008TIMER2_COMPTimer/Counter2 Compare Match
60x000ATIMER2_OVFTimer/Counter2 Overflow
70x000CTIMER1_CAPTTimer/Counter1 Capture Event
80x000ETIMER1_COMPATimer/Counter1 Compare Match A
90x0010TIMER1_COMPBTimer/Counter1 Compare Match B
100x0012TIMER1_OVFTimer/Counter1 Overflow
110x0014TIMER0_COMPTimer/Counter0 Compare Match
120x0016TIMER0_OVFTimer/Counter0 Overflow
130x0018SPI_STCSPI Serial Transfer Complete
140x001AUSART0_RXUSART0 Receive complete
150x001CUSART0_UDREUSART Data Register Empty
160x001EUSART0_TXUSART Transmit complete
170x0020USI_STARTUSI Start condition
180x0022USI_OVERFLOWUSI Overflow
190x0024ANALOG_COMPAnalog Comparator
200x0026ADCADC Conversion complete
210x0028EE_READYEEPROM Ready
220x002ASPM_READYStore Program Memory Ready
230x002CNOT_USEDReserved
240x002EPCINT2Pin Change Interrupt Request 2
250x0030PCINT3Pin Change Interrupt Request 3
Note:
  1. When the BOOTRST fuse is programmed, the device will jump to the boot loader address at Reset. See “Boot Loader Support – Read-While-Write Self-Programming”.
  2. When setting the IVSEL bit in MCUCR, 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 most typical and general program setup for the Reset and Interrupt Vector Addresses is:
Address   Labels    Code                         Comments
0x0000               jmp      RESET               ; Reset Handler
0x0002               jmp      INT0                ; IRQ0 Handler 
0x0004               jmp      PCINT0              ; PCINT0 Handler
0x0006               jmp      PCINT1              ; PCINT1 Handler
0x0008               jmp      TIMER2_COMP         ; Timer2 CompareA Handler
0x000A               jmp      TIMER2_OVF          ; Timer2 Overflow Handler
0x000C               jmp      TIMER1_CAPT         ; Timer1 Capture Handler
0x000E               jmp      TIMER1_COMPA        ; Timer1 CompareA Handler
0x0010               jmp      TIMER1_COMPB        ; Timer1 CompareB Handler
0x0012               jmp      TIMER1_OVF          ; Timer1 Overflow Handler
0x0014               jmp      TIMER0_COMP         ; Timer0 Compare Handler
0x0016               jmp      TIMER0_OVF          ; Timer0 Overflow Handler
0x0018               jmp      SPI_STC             ; SPI Transfer Complete Handler
0x001A               jmp      USART0_RX           ; USART RX Complete Handler
0x001C               jmp      USART0_UDRE         ; USART UDR Empty Handler
0x0020               jmp      USI_START           ; USI Start Condition Handler
0x0022               jmp      USI_UDREOVERFLOW    ; USI Overflow Handler
0x0024               jmp      ANALOG_COMP         ; Analog Comparator Handler
0x0026               jmp      ADC                 ; ADC Conversion Complete Handler
0x0028               jmp      EE_READY            ; EEPROM Ready Handler
0x002A               jmp      SPM_READY           ; SPM Ready Handler
0x002C               jmp      NOT_USED            ; Reserved Handler
0x002E               jmp      PCINT2              ; PCINT2 Handler Handler
0x0030               jmp      PCINT3              ; PCINT3 Handler Handler
;
0x0034    RESET:     ldi      r16,high(RAMEND)    ; Main program start     
0x0035               out      SPH,r16             ; Set Stack Pointer to top of RAM
0x0036               ldi      r16,low(RAMEND)
0x0037               out      SPL,r16
0x0038               sei                          ; Enable interrupts
0x0039               <instr>  xxx
...       ...        ...                             ...