Interrupt vector tables

published: 21 April 2020 / updated 8 June 2020

Lire cette page en français

 

Using interrupt vectors

Specific Flash Forth

To assign the execution of a word written in FORTH language to an interruption, two things are needed:

Retrieving the execution address

The execution address of a FORTH word, abbreviated cfa, can be obtained by simply typing:

#2 constant INT0 
variable COUNTER 
: count.inc ( ---) 
    COUNTER 1+! 
  ;i 
' count.inc  INTO int! 

The sequence ' count.inc retrieves the address cfa of the word count.inc.

VERY IMPORTANT

Any FORTH word used in an interrupt vector must complete its definition with the word ;i and not the word ;

Assignment of the interrupt vector

In the example above, the sequence INTO int! affects the cfa from the word count.inc to the interrupt vector corresponding to INT0 (value 2).

The word int! accepts a vector number. A vector is not a memory address!

In the example, this assignment is made in interpreted mode. Extract:

' count.inc  INTO int! 

If we had wanted to use the INT1 interrupt, we would have written:

#3 constant INT1 
' count.inc  INT1 int! 

To initialize an interrupt vector in the definition of a FORTH word, we will use the word ['] like this:

: int.init ( ---) 
    ['] count.inc  INT1 int! 
  ; 

ATmega328P Interrupt Vector Table

The Atmega328 processor equips all of the following ARDUINO cards:

Vector No Program Address Source Interrupt Definition
1$0000RESET 
2$0002INT0External Interrupt Request 0
3$0004INT1External Interrupt Request 1
4$0006PCINT0Pin Change Interrupt Request 0
5$0008PCINT1Pin Change Interrupt Request 1
6$000APCINT2Pin Change Interrupt Request 2
7$000CWDTWatchdog Time-out Interrupt
8$000ETIMER2 COMPATimer/Counter2 Compare Match A
9$0010TIMER2 COMPBTimer/Counter2 Compare Match B
10$0012TIMER2 OVFTimer/Counter2 Overflow
11$0014TIMER1 CAPTTimer/Counter1 Capture Event
12$0016TIMER1 COMPATimer/Counter1 Compare Match A
13$0018TIMER1 COMPBTimer/Counter1 Compare Match B
14$001ATIMER1 OVFTimer/Counter1 Overflow
15$001CTIMER0 COMPATimer/Counter0 Compare Match A
16$001ETIMER0 COMPBTimer/Counter0 Compare Match B
17$0020TIMER0 OVFTimer/Counter0 Overflow
18$0022SPI, STCSPI Serial Transfer Complete
19$0024USARTRX USART Rx Complete
20$0026USART, UDREUSART Data Register Empty
21$0028USARTTX USART
22$002AADCADC Conversion Complete
23$002CEE READYEEPROM Ready
24$002EANALOG COMPAnalog Comparator
25$0030TWI2-wire Serial Interface (I2C)
26$0032SPM READYStore Program Memory Ready

ATmega2560 Interrupt Vector Table

The Atmega2560 processor equips all of the following ARDUINO cards:

Vector No Program Address Source Interrupt Definition
1$0000RESETExternal Pin, Power-on Reset,
Brown-out Reset, Watchdog Reset
and JTAG AVR Reset
2$0002INT0External Interrupt Request 0
3$0004INT1External Interrupt Request 1
4$0006INT2External Interrupt Request 2
5$0008INT3External Interrupt Request 3
6$000AINT4External Interrupt Request 4
7$000CINT5External Interrupt Request 5
8$000EINT6External Interrupt Request 6
9$0010INT7External Interrupt Request 7
10$0012PCINT0Pin Change Interrupt Request 0
11$0014PCINT1Pin Change Interrupt Request 1
12$0016PCINT2Pin Change Interrupt Request 2
13$0018WDTWatchdog Time-out Interrupt
14$001ATIMER2 COMPATimer/Counter2 Compare Match A
15$001CTIMER2 COMPBTimer/Counter2 Compare Match B
16$001ETIMER2 OVFTimer/Counter2 Overflow
17$0020TIMER1 CAPTTimer/Counter1 Capture Event
18$0022TIMER1 COMPATimer/Counter1 Compare Match A
19$0024TIMER1 COMPBTimer/Counter1 Compare Match B
20$0026TIMER1 COMPCTimer/Counter1 Compare Match C
21$0028TIMER1 OVFTimer/Counter1 Overflow
22$002ATIMER0 COMPATimer/Counter0 Compare Match A
23$002CTIMER0 COMPBTimer/Counter0 Compare match B
24$002ETIMER0 OVFTimer/Counter0 Overflow
25$0030SPI, STCSPI Serial Transfer Complete
26$0032USART0 RXUSART0 Rx Complete
27$0034USART0 UDREUSART0 Data Register Empty
28$0036USART0 TXUSART0 Tx Complete
29$0038ANALOG COMPAnalog Comparator
30$003AADCADC Conversion Complete
31$003CEE READYEEPROM Ready
32$003ETIMER3 CAPTTimer/Counter3 Capture Event
33$0040TIMER3 COMPATimer/Counter3 Compare Match A
34$0042TIMER3 COMPBTimer/Counter3 Compare Match B
35$0044TIMER3 COMPCTimer/Counter3 Compare Match C
36$0046TIMER3 OVFTimer/Counter3 Overflow
37$0048USART1 RX USART1 Rx Complete
38$004AUSART1 UDREUSART1 Data Register Empty
39$004CUSART1 TXUSART1 Tx Complete
40$004ETWI2-wire Serial Interface
41$0050SPM READYStore Program Memory Ready
42$0052TIMER4 CAPTTimer/Counter4 Capture Event
43$0054TIMER4 COMPATimer/Counter4 Compare Match A
44$0056TIMER4 COMPBTimer/Counter4 Compare Match B
45$0058TIMER4 COMPCTimer/Counter4 Compare Match C
46$005ATIMER4 OVFTimer/Counter4 Overflow
47$005CTIMER5 CAPTTimer/Counter5 Capture Event
48$005ETIMER5 COMPATimer/Counter5 Compare Match A
49$0060TIMER5 COMPBTimer/Counter5 Compare Match B
50$0062TIMER5 COMPCTimer/Counter5 Compare Match C
51$0064TIMER5 OVFTimer/Counter5 Overflow
52$0066USART2 RXUSART2 Rx Complete
53$0068USART2 UDREUSART2 Data Register Empty
54$006AUSART2 TXUSART2 Tx Complete
55$006CUSART3 RXRx Complete
56$006EUSART3 UDREUSART3 Data Register Empty
57$0070USART3 TXUSART3 Tx Complete