Managing External Interrupts with Harmony


PIC32 MCUs have up to 8 input pins capable of generating MCU interrupts. These pins are referred to as external I/O pins and are designated on the individual data sheets 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 for an external interrupt.

Interrupt Pin Operation

  • PIC32 MCUs can have up to 8 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 setup 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 the user to select which INT pins to include, and to configure each pin.
  • When the Generate Button is clicked, MHC will add the initialization code for the INT pins to system_init.c
  • INT-initialization.png

Writing the Interrupt Service Routine

  • MHC inserts code for stub ISR into system-interrupt.c
  • The application developer must then add the desired functionality to the stub ISRs.
© 2019 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.