An interrupt is the way that the outside world attracts the attention of a processor. In a PC interrupts are caused by many external devices, for example keyboards, sound cards, network cards and hard disks.

When the interrupt occurs the processor will stop the foreground program and divert to an interrupt handler which is a piece of code which will deal with the particular event. When the event has been dealt with the interrupt handler will obey an instruction which returns execution to the foreground program.

The PICmicro has only a single interrupt, whereas other computer processors may have several. Interrupts can be generated from a number of sources:

- External interrupt signal (on PORTB bit 0)

- Timer Overflow

- Change on inputs (on PORTB bits 4-7)

- EEPROM write complete

We will use some of these interrupts in the practical exercises. When any of the above interrupts occurs the PICmicro branches to a particular address. In the case of C2C a call is made to a function with the special name of interrupt. The function must then decide which of the four items above caused the interrupt and then invoke an appropriate handler.

On the right you can see the bit assignments in the INTCON register and how they are used.