Interrupt Code Example in C using chipKIT™ WF32

 Objective

This page provides a basic interrupt exception code example for the PIC32MX MCU. The project configures the Timer 2 period match interrupt event to trigger an ISR that toggles LED LD6 on the development board every 100mS.

The hardware for this project uses the ArduinoTM compatible chipKIT WF-32 board from Digilent Inc.

 Materials

Hardware Tools (Optional)

Tool About Purchase
chipkit-wifire-50px.png
chipKIT™ WF32
Development Board
PICkit3-50px.png
PICkit™ 3
In-Circuit Debugger
TPROG001-50px.png
TPROG001
PICkit 3 Programming Cable Kit
AC002014-50px.png
AC002014
9V Wall Mount Power Supply

Software Tools

This project has been verified to work with the following versions of software tools:
MPLAB® X IDE v3.15, MPLAB® XC32 Compiler v1.40. The current versions of these tools will probably work as well, so try using them first.

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
MPLAB® X
Integrated Development Environment
MPLAB® XC32
C/C++ Compiler

Exercise Files

File Download
Installation
Instructions
Windows Linux Mac OSX
Project and Source Files

We recommend extracting the .zip to the following "root" folders:

Windows:

  • C:


Linux:

  • /home/<username>/MPLABXProjects


Mac OS:

  • Users/<username>/MPLABXProjects


You should see an appended sub-folder "/MTT/32bit-mx/code-examples/interrupt-usage" containing the project "interrupt-usage.X"

 Procedure

Attach the debugger to the WF-32 board. Power up the board. Start MPLAB X.

1

Open the project

mplabx-open-project.png

2

Build/Run the project

mplabx-build-run.png

 Results

code-examples-interrupt-usage-results.png

 Conclusions

This project has provided an example of how to setup and use interrupt exceptions on the PIC32MX MCU. For more information on the steps required to setup and configure interrupts on the PIC32MX, please visit the PIC32MX Interrupt and Exception Usage page.

© 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.