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.
INT-pin.png

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.
INT-pin-setup.png
  • When you click the Generate button, MHC will add the initialization code for the INT pins to system_init.c.
INT-initialization.png

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.
INT-isr.png
© 2024 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.