Interrupt handler

How to handle interrupts on a PIC microcontroller

08-26-2017 Alex 0

Most of the time, embedded systems have time sensitive inputs that need to be handled as soon as they are triggered, with minimal delay. This is usually done by using interrupts. Interrupts are pieces of code that are run when an event occurs on one of the microcontroller’s ports, or internal components such as a timer. The execution of the main program is paused, and the microcontroller jumps to the interrupt code (in reality, it jumps to a given address in the program memory, reserved to the interrupt instructions). Once it  finishes executing the interrupt code, it will go back to where it stopped in the main program. In this tutorial we’re going to learn how to implement an interrupt when a user pushes on a button.