Beginner Lab 3: LED Toggle With Software Delay
Objective
- Configure a General Purpose Input/Output (GPIO) pin to control the state of an LED on the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit.
- Implement a software-based delay using for-loops to achieve a 500 ms interval for toggling the LED.
- Write and test embedded C code to toggle the LED state at regular intervals without using hardware timers.
- Demonstrate how software loops can be used for timing control in embedded applications.
- Gain practical experience in basic GPIO output programming and software-generated delays.
- Establish a foundation for understanding timing and control in embedded systems through hands-on coding and hardware interaction.
Overview
This lab provides a practical introduction to basic embedded programming by focusing on the control of LED indicators through GPIO outputs. Code is written to toggle LEDs with a 500‑ms delay, achieved using for‑loops to create software‑based timing. The exercise is designed as a beginner‑level activity, making it accessible for those new to microcontroller programming. Through this lab, experience is gained in configuring GPIO pins, manipulating digital outputs, and understanding the principles of software‑generated delays. This foundational knowledge supports further exploration of embedded systems and real‑time application development.
Lab Activities
- Program the PIC32CM LS00 Curiosity Nano+ Touch Evaluation Kit to toggle LEDs on and off.
- Implement a 500 ms delay between each toggle using software for-loops.
- Observe and analyze the behavior of the LEDs in response to the programmed delay.
Expected Outcomes
Upon completion of this lab, the following skills will be acquired:
- Demonstrate the ability to control GPIO outputs.
- Apply software-based delay techniques in embedded programming.
- Gain practical experience in basic coding for microcontroller 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).
for this lab.
Lab Index
- Step 1: GPIO and Software-Based Delays
- Step 1.1 - Understanding GPIO
- Step 1.2 - Understanding Software-Based Delays
- Step 2: Configuration of MPAB Code Configurator (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