Beginner Lab 9: Timer Interrupt
Objective
- Configure and utilize a hardware timer module on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to generate precise timing delays.
- Implement timer‑based control to toggle an LED at fixed intervals.
- Compare hardware timer–based delays with software delay loops to understand their accuracy and efficiency.
- Develop proficiency in register‑level timer configuration for embedded applications.
- 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).
for this lab.
Lab Index
- Step 1: Interrupt-Driven Timing and ISRs
- Step 1.1 - Understanding Interrupt-Driven Timing and ISRs
- Step 2: Configuration of MCC
- Step 2.1 - Configuration of MCC
- Step 3: Generate Code
- Step 3.1 - Generate Code
- Step 4: Add Application Code to the Project
- Step 4.1 - Add application code to the project
- Step 5: Build, Program and Observe the Output
- Step 5.1 - Hardware Setup
- Step 5.2 - Building the project
- Step 5.3 - Programming and Observing the output