11.3.3 Interrupt Vector Table Address Calculation

MVECEN = 0

When the MVECEN Configuration bit is cleared, the address pointed to by IVTBASE is used as the high-priority interrupt vector address. The low-priority interrupt vector address is offset eight instruction words from the address in IVTBASE.

For PIC18 devices, IVTBASE defaults to 000008h, hence the high-priority interrupt vector address will be 000008h and the low-priority interrupt vector address will be 000018h.

MVECEN = 1

Each interrupt has a unique vector number associated with it, as defined in the IVT. This vector number is used for calculating the location of the interrupt vector for a particular interrupt source.

Interrupt Vector Address = IVTBASE + (2*Vector Number). This calculated interrupt vector address value is stored in the IVTAD register when an interrupt is received.

User-assigned software priority, when assigned using the IPRx registers, does not affect address calculation and is only used to resolve concurrent interrupts.

Important: If for any reason the address of the ISR cannot be fetched from the vector table, it will cause the system to reset and clear the Memory Execution Violation flag in the Power Control register. This can occur due to any one of the following:
  • The entry for the interrupt in the vector table lies outside the executable program memory area
  • ISR pointed by the vector table lies outside the executable program memory area
Table 11-1. IVT Calculations Summary
IVT Address Calculation Interrupt Priority INTCON0 Register, IPEN Bit
0 1
Multivector Enable,

MVECEN Configuration bit

0 IVTBASE High-priority IVTBASE
Low-priority IVTBASE + 8 words
1 IVTBASE + 2*(Vector Number)