Beginner Lab 5: LED Toggle With Timer Module

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

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 hardware‑based timing in embedded systems by focusing on controlling an LED using a microcontroller’s timer module. Instead of relying on software delay loops, timer registers are configured to generate precise and consistent timing intervals for toggling an LED. The activity builds on basic General Purpose Input/Output (GPIO) knowledge while introducing register‑level interaction with on‑chip peripherals. Designed as a moderate‑level exercise, the lab highlights the advantages of hardware timers over software delays in terms of accuracy, efficiency, and reliability. Upon completion, practical experience is gained in timer configuration, reinforcing the role of hardware‑assisted timing in real‑time embedded applications.

Lab Activities

  • Program the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to toggle LEDs ON and OFF using a hardware timer module.
  • Configure timer registers to generate precise, periodic delays for controlling the LED toggle rate.
  • Observe and analyze the behavior of the LEDs to verify accurate and consistent timing provided by the hardware timer.

Expected Outcomes

Upon completing this lab, you will be able to:

  • Demonstrate the ability to configure and use hardware timer modules in a microcontroller.
  • Apply register‑level programming to achieve precise timing control for GPIO operations.
  • Understand and compare the advantages of hardware timer-based delays over software delay loops in embedded applications.

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. The project location of an MPLAB® Harmony v3 project is independent of the location of the MPLAB Harmony framework path (in other words, there is no requirement to create or place an MPLAB Harmony v3 project in a relative path under the Harmony v3 framework folder). The project can be created or placed in any directory of your choice.
  2. The point above is true because when created, an MPLAB Harmony v3 project generates all the referred source and header files and libraries (if any) under the project folder.

Lab Index

Back to Top