Our products, Nanode, wireless, MCUs, electronics and more

Must Read Tutorial: Timers and Interrupts

Posted: June 7th, 2011 | Author: | Filed under: Uncategorized | Tags: , , , , | Comments Off on Must Read Tutorial: Timers and Interrupts

I think there are probably a lot of Arduino users out there who either (a) don’t know about interrupts, or (b) don’t know you can use them in the Arduino environment. I will almost certainly be using the Timer Interrupt capability of the ‘duino in an upcoming project that uses Charliplexing (get excited!). I found the following to be an excellent overview and reference in that respect: http://www.uchobby.com/index.php/2007/11/24/arduino-interrupts/

For more “advanced” Arduino users, it helps to keep in mind that at the end of the day, all your source code gets compiled using avr-gcc, so in principle you can do anything with an Arduino that you could do by targetting an ATMega328 (or ATMega168) using vanilla avr-gcc (i.e. use any of the chip’s hardware). For some things it’s harder than for others because the core Arduino libraries implement some of the interrupt handlers (ISRs), but for some things, like Timer2, it’s open season! Other than that you just have to make sure you are not trampling over some other (Arduino) function of the hardware resource you want to hijack :). Have fun!