14 Interrupts

The PIC18(L)F65/66K40 devices have multiple interrupt sources and an interrupt priority feature that allows most interrupt sources to be assigned a high or low-priority level. The high-priority interrupt vector is at 0008h and the low-priority interrupt vector is at 0018h. A high-priority interrupt event will interrupt a low-priority interrupt that may be in progress.

The registers for controlling interrupt operation are:

  • INTCON
  • PIRx (Interrupt flags)
  • PIEx (Interrupt enables)
  • IPRx (High/Low interrupt priority)

It is recommended that the Microchip header files supplied with MPLAB® IDE be used for the symbolic bit names in these registers. This allows the assembler/compiler to automatically take care of the placement of these bits within the specified register.

In general, interrupt sources have three bits to control their operation. They are:

  • Flag bit to indicate that an interrupt event occurred
  • Enable bit that allows program execution to branch to the interrupt vector address when the flag bit is set
  • Priority bit to select high priority or low priority