Home / Learn Embedded C / Memory-Mapped I/O Explained
Memory-Mapped I/O Explained
How peripheral registers appear as regular memory addresses that ordinary load/store instructions can access.
How to think about this
In plain terms
Memory-mapped I/O means peripheral control and status registers are assigned regular memory addresses, so the same load/store (read/write) instructions a CPU uses for RAM also read and write hardware registers — no special I/O instructions needed.
Why we use it
This is why, throughout this course, "reading a register" and "writing a register" have used exactly the same C syntax as reading/writing any other variable — the whole mechanism this course has been teaching rests on this single architectural idea.
Under the hood
A fixed range of the chip's overall address space is reserved for each peripheral's registers; accessing an address in that range does not touch RAM at all, but instead directly reads/writes that peripheral's hardware state.
Real-world use
- All register-level peripheral access
- Chip architecture understanding
- Low-level driver development
Try it
In real C this would be `*(volatile unsigned int*)0x40020014 |= (1 << 5);` — the bit operation itself is identical either way.
Try it: reading a status register vs an ordinary variable
Both lines use plain C assignment and bitwise operators; nothing in the syntax reveals that one is backed by RAM and the other by a hardware register.
Quick quiz
1. What does "memory-mapped" mean for a peripheral's registers?
Memory mapping is precisely what lets ordinary variable-style reads/writes in C directly manipulate hardware registers.