3.2. PIC16 C Interrupts

• C interrupt functions

• Interrupt sources

• External interrupt

Interrupts allow an external event to initiate a control sequence that takes priority over the current MCU activity. Typically, the interrupt service routine (ISR) carries out some operation associated with the port or internal device that requested the interrupt.

Interrupts are frequently used with hardware timers, which provide delays, timed intervals, and measurement. A time delay can be implemented using a simple software counting loop, but this has the disadvantage of tying up the processor while the delay executes. A more efficient technique is to use a hardware timer running independently from the MCU clock. This allows accurate timing to be more easily ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.