3.3.1 Interrupt Vectors in ATmega328P Automotive
A clarification for the source names of the Interrupt vectors has been made to comply with the header file naming convention.
Table 11-1. Reset and Interrupt Vectors in ATmega328P Automotive
Vector No | Program Address(2) | Source | Interrupts definition |
---|---|---|---|
1 | 0x0000(1) | RESET | External pin, Power-on Reset, Brown-out Reset and Watchdog System Reset |
2 | 0x0002 | INT0 | External Interrupt Request 0 |
3 | 0x0004 | INT1 | External Interrupt Request 1 |
4 | 0x0006 | PCINT0 | Pin Change Interrupt Request 0 |
5 | 0x0008 | PCINT1 | Pin Change Interrupt Request 1 |
6 | 0x000A | PCINT2 | Pin Change Interrupt Request 2 |
7 | 0x000C | WDT | Watchdog Time-out Interrupt |
8 | 0x000E | TIMER2_COMPA | Timer/Counter2 Compare Match A |
9 | 0x0010 | TIMER2_COMPB | Timer/Coutner2 Compare Match B |
10 | 0x0012 | TIMER2_OVF | Timer/Counter2 Overflow |
11 | 0x0014 | TIMER1_CAPT | Timer/Counter1 Capture Event |
12 | 0x0016 | TIMER1_COMPA | Timer/Counter1 Compare Match A |
13 | 0x0018 | TIMER1_COMPB | Timer/Coutner1 Compare Match B |
14 | 0x001A | TIMER1_OVF | Timer/Counter1 Overflow |
15 | 0x001C | TIMER0_COMPA | Timer/Counter0 Compare Match A |
16 | 0x001E | TIMER0_COMPB | Timer/Coutner0 Compare Match B |
17 | 0x0020 | TIMER0_OVF | Timer/Counter0 Overflow |
18 | 0x0022 | SPI_STC | SPI Serial Transfer Complete |
19 | 0x0024 | USART_RX | USART Rx complete |
20 | 0x0026 | USART_UDRE | USART Data Register Empty |
21 | 0x0028 | USART_TX | USART Tx complete |
22 | 0x002A | ADC | ADC Conversion complete |
23 | 0x002C | EE_READY | EEPROM Ready |
24 | 0x002E | ANALOG_COMP | Analog Comparator |
25 | 0x0030 | TWI | Two-wire Serial Interface (I2C) |
26 | 0x0032 | SPM_READY | Store Program Memory Ready |
Note:
- 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”.
- 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
for ATmega328P Automotive
is:
Address Labels Code Comments
0x0000 jmp RESET ; Reset
0x0001 jmp INT0 ; IRQ0
0x0002 jmp INT1 ; IRQ1
0x0003 jmp PCINT0 ; PCINT0
0x0004 jmp PCINT1 ; PCINT1
0x0005 jmp PCINT2 ; PCINT2
0x0006 jmp WDT ; Watchdog Timeout
0x0007 jmp TIMER2_COMPA ; Timer2 CompareA
0x0008 jmp TIMER2_COMPB ; Timer2 CompareB
0x0009 jmp TIMER2_OVF ; Timer2 Overflow
0x000A jmp TIMER1_CAPT ; Timer1 Capture
0x000B jmp TIMER1_COMPA ; Timer1 CompareA
0x000C jmp TIMER1_COMPB ; Timer1 CompareB
0x000C jmp TIMER1_OVF ; Timer1 Overflow
0x000E jmp TIMER0_COMPA ; Timer0 CompareA
0x000F jmp TIMER0_COMPB ; Timer0 CompareB
0x0010 jmp TIMER0_OVF ; Timer0 Overflow
0x0011 jmp SPI_STC ; SPI Transfer Complete
0x0012 jmp USART_RXC ; USART RX Complete
0x0013 jmp USART_UDRE ; USART UDR Empty
0x0014 jmp USART_TXC ; USART TX Complete
0x0015 jmp ADC ; ADC Conversion Complete
0x0016 jmp EE_READY ; EEPROM Ready
0x0017 jmp ANA_COMP ; Analog Comparator
0x0018 jmp TWI ; 2-wire Serial
0x0019 jmp SPM_READY ; SPM Ready
;
0x001A RESET: ldi r16,high(RAMEND) ; Main program start
0x001B out SPH,r16 ; Set Stack Pointer to top of RAM
0x001C ldi r16,low(RAMEND)
0x001D out SPL,r16
0x001E sei ; Enable interrupts
0x001F <instr> xxx
... ... ... ...