Beginner Lab 9: Timer Interrupt

Last modified by Microchip on 2026/06/26 07:39

Objective

  1. Configure and utilize a hardware timer module on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to generate precise timing delays.
  2. Implement timer‑based control to toggle an LED at fixed intervals.
  3. Compare hardware timer–based delays with software delay loops to understand their accuracy and efficiency.
  4. Develop proficiency in register‑level timer configuration for embedded applications.
  5. Gain practical experience using hardware peripherals to achieve reliable timing control in embedded systems.

Overview

This lab introduces timer interrupts as a core concept in embedded systems. Instead of continuously checking timer status or using software delays, the microcontroller is configured to automatically trigger an interrupt at fixed time intervals. When the timer interrupt occurs, an Interrupt Service Routine (ISR) executes to toggle an LED. This interrupt‑driven approach demonstrates how embedded systems can efficiently handle time‑critical tasks while allowing the CPU to perform other operations. The lab builds upon prior knowledge of General Purpose Input/Output (GPIO) and hardware timers while introducing ISR structure and best practices, making it an intermediate‑level exercise in embedded programming.

Lab Activities

  • Configure a hardware timer on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to generate a 500 ms interrupt.
  • Enable and configure the timer interrupt in the interrupt controller.
  • Write an ISR to toggle an LED each time the interrupt occurs.
  • Program and test the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to observe consistent LED blinking driven by the timer interrupt.

Expected Outcomes

Upon completing this lab, you will be able to:

  • Ability to configure hardware timers to generate periodic interrupts.
  • Understanding of ISR design and implementation for timer-based events.
  • Improved skills in developing embedded applications that utilize interrupt-driven timing for efficient and accurate control.

Lab Source Files and Solutions

This ZIP file contains the completed solution project for this lab. It also contains the source files needed to perform the lab as per the following step-by-step instructions (see the "Lab Index" section on this page).

Download the ZIP file for this lab.

Information

The contents of this ZIP file need to be placed in the following folder:

<Any directory of the user's choice>/
(example Directory = C:/microchip/harmony/v3)

Note:

  1. An MPLAB® Harmony v3 project can be created in any directory. Its location does not depend on the MPLAB Harmony framework path, so it does not need to be placed under the Harmony v3 framework folder or in any relative path beneath it.
  2. This is possible because the project generates its required files locally. When an MPLAB Harmony v3 project is created, all referenced source files, header files, and libraries, if applicable, are generated within the project folder.

Lab Index

  1. PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit
  2. MPLAB X Integrated Development Environment (IDE)
  3. MPLAB XC32 Compiler
  4. PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit: EV41C56A User Guide
  5. Ultra-Low Power, Secure, and Enhanced Touch MCU: PIC32CM LE00/LS00/LS60 Datasheet 

Back to Top