Managing External Interrupts with Harmony v2
Summary
PIC32 MCUs have up to eight input pins capable of generating MCU interrupts. These pins are referred to as external I/O pins and are designated on the individual datasheets with the pin name INTx.
This page describes how to configure Harmony to use the external interrupts and how to write an Interrupt Service Routine (ISR) for an external interrupt.
Interrupt Pin Operation
- PIC32 MCUs can have up to eight pins capable of generating interrupts.
- External Interrupt pins are designated by an INT pin name.
- When configured, these pins can be set to generate interrupts on a rising or a falling edge.
- Each INT pin can be assigned its own interrupt priority and sub-priority.
- Each INT pin has its own interrupt vector and separate ISR.
Setting up External Interrupts
- The MPLAB® Harmony Configurator (MHC) is used to set up external interrupt pins.
- To enable interrupts, select the box Use Interrupt System Service? and Use External Interrupts under Harmony Framework Configuration > System Services > Interrupts.
- A dialog box will appear, allowing you to select which INT pins to include, and to configure each pin.
- When you click the Generate button, MHC will add the initialization code for the INT pins to system_init.c.
Writing the Interrupt Service Routine (ISR)
- MHC inserts code for stub ISR into system-interrupt.c
- You must then add the desired functionality to the stub ISRs.