As embedded systems, smart home peripherals, and IoT devices become more complex, writing efficient, reliable, and non-blocking firmware is a crucial skill for any electronics technician or hardware designer. Designed for beginners and entry-level hardware developers, EE-13 bridges the gap between basic circuit assembly and advanced microcontroller development.
Objective and Audience
This course teaches participants the fundamental principles of C and C++ programming tailored specifically to microcontroller architectures. Students will master basic syntax, memory management, pointers, structured functions, interrupt handling, and non-blocking firmware architecture essential for reading sensors and controlling hardware peripherals.
The course is designed for students, novice engineers, electronics hobbyists, and automation technicians who have basic circuit knowledge but lack formal coding experience for embedded platforms. Courses EE-3 Basics of Electronics and Electrical Engineering and EE-6 Basics of measuring with a multimeter serve as helpful preparation, while EE-13 acts as a direct bridge to EE-31 Embedded Systems for Smart Home (ESP32).
Proposed Format
Ten 90-minute lessons (totaling 15 instructional hours). Approximately one-third of each lesson is dedicated to technical theory and code walkthroughs; the remainder is spent on hands-on firmware writing, compilation, debugging, and testing on simulators/hardware boards. Instructor-led lab sessions or remote sessions are supported.
Learning Outcomes
By the end of the course, participants will be able to:
- Understand the specific requirements of C/C++ in resource-constrained microcontroller environments (Flash, RAM).
- Safely utilize data types, variables, arrays, pointers, and bitwise operations.
- Write clean, readable, and modular code using structured functions and custom libraries.
- Implement non-blocking delays using hardware/software timers instead of blocking delay() functions.
- Configure and handle hardware and software interrupts (ISR).
- Locate and fix syntax and runtime bugs using serial log monitors and debugging tools.
Lesson Plan
- Introduction to C/C++ for Embedded Systems:
Program structure, compilation process, variables, data types, and scope. Setting up the IDE and outputting data via Serial Monitor.
- Control Flow and Logic:
Conditional statements (if/else, switch), loops (for, while), reading digital inputs, and controlling GPIO pins.
- Functions and Modular Code:
Function declarations, passing arguments by value and reference, return types, and multi-file project organization.
- Arrays, Strings, and Buffers:
1D and 2D arrays, C-style strings, formatted printing with sprintf/printf for sensor telemetry formatting.
- Pointers and Memory Architecture:
Memory addresses, pointers, dereferencing, passing pointers to functions, understanding RAM layout and avoiding memory leaks.
- Bitwise Operations and Registers:
Bitwise operators (AND, OR, XOR, shifts), bit masking, setting/clearing individual register flags.
- Structures and Enumerations (struct & enum):
Defining custom data structures for complex sensor data, building state machines using enum.
- Non-Blocking Architecture and Timers:
Replacing delay() calls. Designing timestamp-based loops (millis/micros) for multi-tasking on single-core microcontrollers.
- Interrupts and Event-Driven Logic:
Interrupt Service Routines (ISR), the volatile keyword, handling time-critical hardware events (buttons, encoders, sensors).
- Firmware Debugging and Final Project:
Debugging strategies, stack analysis, writing a complete multi-tasking sensor application, and final assessment.
Back to the section
|