14

Interrupts

New instructions used in this chapter:

• RETFIE

We all know what interrupts are and we don't like being interrupted. We are busy doing something and the phone rings or someone arrives at the door.

If we are expecting someone, we could look out of the window every now and again to see if they had arrived or we could carry on with what we are doing until the doorbell rings. These are two ways of receiving an interrupt. The first when we keep checking in software terms is called polling, the second when the bell rings is equivalent to the hardware interrupt.

We have looked at polling when we used the keypad to see if any keys had been pressed. We will now look at the interrupt generated by the hardware.

Before moving onto an example ...

Get PIC in Practice, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.