Embedded C from Zero: Bits, Pointers, Registers and Drivers
Embedded C is the language running inside the washing machine, the car dashboard and the smartwatch. This course starts from zero: no programming and no electronics assumed. By the end you will read and write the C that talks straight to hardware - bits, pointers, registers, interrupts, timers and drivers - and explain it in an interview.
Start here
Start with Volume 00. It explains what "embedded" means, how your code ends up running on a chip, and how to run every program in this course for free in a browser, before you own a board. Then take the volumes in order. Each one uses only what came before it.
Every program here was compiled and run before it was published, so the output you see is the output you get. Each new word is underlined with dots - point at it (or tap it) to see what it means. Every sub-module ends with a quick check.
Take the quick checks in Volumes 01 to 03 without reading them. If you get them all right, start at Volume 04, where the bit manipulation begins - that is where embedded C parts company with the C taught for computers.
Full syllabus
Part I - First steps
- 00 Start Here: What Embedded Means What an embedded system is, how a microcontroller differs from a computer, how your C becomes a running chip, and how to run every program in this course free in a browser. Live
- 01 Your First C Programs Hello world with every line explained, then variables and types, if and switch, the three loops, and writing your own functions. Live
Part II - How C sees data
- 02 How Data Lives in Memory Bits, bytes and addresses, binary and hexadecimal, the fixed-width integer types, two’s complement, overflow and endianness. Live
- 03 Operators Without Surprises Integer division and remainder, comparison and logic, the conversions C performs behind your back, precedence traps, and floating point on small chips. Live
- 04 Bit Manipulation The four bitwise operators, shifts, setting, clearing, toggling and testing bits, masks and fields, bit-fields in structs, and the classic bit puzzles. Live
Part III - The C that firmware needs
- 05 Functions, Scope and Storage Local and global variables, static and extern, const and volatile, how the stack grows with each call, and why firmware avoids recursion. Live
- 06 Arrays and Strings Arrays in memory, looping over them safely, strings and the NUL character, the string functions that bite, and how buffer overflows happen. Live
- 07 Pointers from Zero What a pointer really is, & and *, why arrays and pointers feel the same, pointer arithmetic, const with pointers, void pointers and NULL, and function pointers. Live
- 08 Structs, Unions and Enums Grouping data in structs, the padding the compiler inserts, packed structs and their cost, unions for reinterpreting bytes, and enums with typedef. Live
Part IV - Inside the chip
- 09 The Memory Map and Start-Up Flash and RAM, the sections .text, .data, .bss, the stack and the heap, the linker script in plain words, what runs before main, and how to read a map file. Live
- 10 Talking to Hardware: Registers Memory-mapped I/O, why volatile is not optional here, register structs in CMSIS style, safe read-modify-write, and a GPIO driver written from scratch. Live
- 11 Interrupts Polling versus interrupts, the vector table and the NVIC, writing an interrupt handler, priorities and nesting, sharing data with a handler safely, and critical sections. Live
- 12 Time: Delays, Timers and PWM Why busy-wait delays waste a chip, hardware timers and SysTick, non-blocking timing with a tick counter, PWM for dimming an LED, and state machines written in C. Live
Part V - Drivers, memory and the build
- 13 Peripheral Drivers Sending and receiving on a UART, ring buffers that never lose a byte, SPI and I2C from the register up, reading an ADC, and what DMA changes. Live
- 14 Dynamic Memory What malloc and free really do, why fragmentation is fatal on a small chip, static allocation instead, memory pools, and the six classic memory bugs. Live
- 15 The Preprocessor and the Build Macros and their traps, include guards and header design, conditional compilation, how compiling and linking really work, Makefiles, and what optimisation breaks. Live
Part VI - Reliable code, and interviews
- 16 Writing Reliable Embedded C A catalogue of undefined behaviour, the MISRA C ideas worth knowing, defensive coding and assertions, watchdogs, and error-handling patterns that scale. Live
- 17 Debugging Embedded Code printf over UART and what it costs, GDB basics, JTAG and SWD breakpoints, reading a HardFault, and when only a logic analyser will do. Live
- 18 Embedded C Interview Vault and Revision The whole course on one page, 45 output-prediction puzzles, 23 bit-manipulation problems, 28 pointer problems and the concept questions interviewers ask. Live
What you need before starting
| What | Why | Free option |
|---|---|---|
| Nothing but curiosity | Volume 00 explains every idea this course uses | - |
| A web browser | To compile and run C without installing anything | An online C compiler, such as Compiler Explorer or Programiz |
| Optional: GCC on your computer | To work offline | GCC is free on Linux and macOS; on Windows, use WSL or MinGW |
| Optional: a microcontroller board | To watch a real LED blink | Any board works - the course never needs one |