Implementing Deterministic Interrupt Service Routines in Embedded C
Learn how to implement deterministic Interrupt Service Routines (ISRs) in embedded C, focusing on volatile variables, critical sections, and avoiding non-reentrant functions.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to implement deterministic Interrupt Service Routines (ISRs) in embedded C, focusing on volatile variables, critical sections, and avoiding non-reentrant functions.
Learn how Embedded C’s named address spaces let you place constant tables directly in flash, saving RAM and removing runtime copies—complete with a GCC‑AVR example, portability tips, and verification steps.
When accessing hardware registers in embedded C, compiler optimizations can silently break your code. The volatile keyword ensures the compiler reads the register each time. This article explains why volatile is essential, shows a GPIO ISR example, and discusses trade‑offs.
On FPU-less Cortex-M0/M0+ cores, soft-float can dominate a control loop. This post explains when Q15 fixed-point helps, how to handle Q30 intermediates and saturation, and a verifiable decision rule.
Use volatile for hardware register accesses, verify with assembly and a hardware debugger, and avoid over‑using it to keep performance high.
How and why to use volatile for memory-mapped hardware registers in embedded C, with a worked register-map example, assembly-level verification, and the limits of what volatile guarantees.
An architecture note on a lock-free single-producer/single-consumer ring buffer for moving data from an ISR to the main loop in embedded C: minimal design, trust boundaries, overflow policy, checks, and failure modes.
Your UART polling loop works at -O0 but hangs at -O2. The culprit: missing volatile on memory-mapped registers. A worked example shows why volatile exists, how to apply it correctly, what it doesn't do, and how to verify the generated assembly.
On microcontrollers without a hardware FPU, float math is emulated in software and costs dearly. This guide shows how Q-format fixed-point arithmetic works, with a complete Q15 sensor-filter example, overflow analysis, and on-target verification steps.