makerNews.info

News for makers.
Arduino, DIY, ESP8266, tools and more.

We run under a strict no-BS policy here. Just scroll down for the news and featured content. New items will jump to your eyes. Almost literally. Recently added: hackster.io and hackaday.io projects, DX.com new DIY products. Tell us your favorite site not yet added!

Arduino Interrupts: keep your ISR functions small and quick!

If your ISR routines are doing too much, they may hog the CPU time, and your main program will starve. A nice ISR function just move values to flags and other variables, and lets the main program deal with the rest.

This week's Embed with Elliot column on Hackaday tells us why, in detail and with example code, and language as clear as this: “If your ISR is going to be called very, very frequently, even a lightweight interrupt can block the main loop. Imagine that it takes a total of 40 cycles just to get into and out of an interrupt, and the interrupt-triggering event ends up happening every 50 cycles. You’re totally blocked if your ISR takes more than ten cycles to run, and your main loop code is reduced to a crawl no matter what. Even the shortest interrupts take some time for call and return.”

Go read it! And read also the first episode of the same series: “Embed with Elliot: Interrupts, The Good… | Hackaday