In part 1 and part 2 we covered what interrupts are and how to write safe ISRs. Now we tackle one of the most useful and widely used interrupt sources in embedded systems: hardware timers. Timer interrupts are the backbone of almost every real embedded application — from blinking an LED at an exact frequency, […]
Writing Your First ISR — Rules, Pitfalls, and the volatile Keyword
In Part 1 we established what interrupts are and why they exist. Now it is time to write actual interrupt service routines (ISRs) and learn the rules that keep them working correctly. This is where many beginners run into mysterious bugs — code that works fine until an interrupt fires, then behaves unpredictably. Almost always, […]
What Are Interrupts and Why Do They Exist?
This is first part of an intended series about interrupts. If you are just starting out with microcontrollers or microprocessors, you have probably written a simple program that turns an LED on and off, reads a button, or sends some text over a serial port. These programs usually follow a straight line: do this, then […]
RETI Instructions
If you spend enough time writing interrupt service routines in low-level embedded code, one tiny instruction shows up again and again: RETI. On paper it looks simple. It means RETurn from Interrupt. In practice, though, that small instruction exposes deep architectural differences between microcontroller families. On some CPUs RETI is a real instruction with distinct […]
Thank you, Mouser and Texas Instruments !
Mailbag today. Guess my surprise when I found this in my mailbox: It’s always nice to receive snail mail. Paper mail. Envelopes, magazines and newspapers. That’s why I try to subscribe to receive printed editions of all magazines of interest for me. Some time ago I signed a promo email from Texas Instruments in cooperation […]