EC-9.2 Memory-Mapped Input and Output
You can find a peripheral register in a datasheet, set or clear one bit in it without touching its neighbours, say why the variable must be marked volatile, and predict what an unconnected input pin will read.
Before:S5-2. Computer Architecture and MicroprocessorsEC-7. Signals and SystemsUnlocks:PE1-4. Embedded C ProgrammingEC-13. Laboratory Practice, in Sequence
This is the single idea that makes embedded programming different from other programming: a memory location that changes when nobody wrote to it, and a memory write that turns on a motor. Every board topic in the area writes to a port before anything has explained what a port is, and this is the explanation those topics assume.
Work through these
A peripheral register is an address
Turning on an output is a write to a particular address, and reading a switch is a read from another. There is no separate instruction for talking to hardware, which is what memory-mapped means.
NPTEL: Embedded Systems Design (IIT Kharagpur) · CourseDirection, output and input registers on a port
A port usually has three registers: one saying which pins are outputs, one holding what the outputs should be, and one reporting what the inputs actually are. Writing to the wrong one of the three is the most common first mistake.
NPTEL: Introduction to Embedded System Design (NSUT and IIT Jammu) · CourseRead-modify-write, and the bug it hides
Setting one bit means reading the register, changing the bit and writing it back. If an interrupt changes another bit in the middle of that, the write puts the old value back and the change is silently lost.
NPTEL: Embedded Systems Design (IIT Kharagpur) · CourseVolatile, and why the compiler needs telling
A compiler that sees a location read twice with no write between may keep the first value. Marking the pointer volatile tells it the hardware can change that location, so every read has to actually happen.
NPTEL: Embedded System Design with ARM (IIT Kharagpur) · CourseBit fields, masks and setting one line without touching the rest
A mask with a single bit set, combined with a bitwise or, turns that line on and leaves the others alone. The same mask inverted and combined with a bitwise and turns it off.
NPTEL: Introduction to Embedded System Design (NSUT and IIT Jammu) · CoursePull-up resistors, open drain and the state of an unconnected pin
An input with nothing attached does not read zero, it reads whatever interference decides. A pull-up or pull-down resistor gives it a defined state, and open-drain outputs rely on one to produce a high level at all.
NPTEL: Microcontrollers and Applications (IIT Kanpur) · Course
Sign in to keep your progress.
Free resources
We haven't checked most of these for screen reader use yet.
- FreeNPTEL / IIT Kharagpur · CourseNPTEL: Embedded Systems Design (IIT Kharagpur)
- FreeNPTEL / Netaji Subhas University of Technology and IIT Jammu · CourseNPTEL: Introduction to Embedded System Design (NSUT and IIT Jammu)
- FreeNPTEL / IIT Kharagpur · CourseNPTEL: Embedded System Design with ARM (IIT Kharagpur)
- FreeNPTEL / IIT Kanpur · CourseNPTEL: Microcontrollers and Applications (IIT Kanpur)
Links last checked 3 Sept 2026.
Stuck here?
Ask a mentor. A real person answers, and they can see exactly which topic you're on. Usually within a couple of working days.
Checking your session…
Topics shown in module order.