Beginner concepts: We’re gonna let you finish, but first this tutorial on Arduino interrupts

OK, year-old pop culture references aside [Kyle] dropped us a line to show us his tutorial on using interrupts with your Arduino. Given the single core nature of your average Arduino’s AVR you pretty much have two choices for monitoring occasional un-timed inputs: Either check an input at an interval (which risks missing the signal entirely) or set up an interrupt to pause the chip’s normal operation. Obviously working with interrupts saves you tons of clock cycles since you are not polling a pin over and over. [Kyle] plans on a follow up tutorial to cover timer based interrupts, which can come in handy when generating frequencies and stuff.

Looking for more Arduino Basics? How about Basic on an Arduino. Check out our other beginner concepts posts as well if you need to work on your fundamentals.

Tool Tip: microcontroller timer calculator

uC_timer_calculator

In life and embedded systems timing is everything. Give [Frank's] web-based timer calculator a try. Set your system clock resolution (in hertz making sure you account for any system clock divider), select your timer resolution and prescaler, then calculate based on desired ticks, overflows, or real time. He’s built this with the AVR chips in mind but it should be handy for any family of microcontrollers.

Of course none of this is rocket science, but if you’re trying to use one timer for two differently synchronized events this can save you a lot of trial and error time.

Follow

Get every new post delivered to your Inbox.

Join 94,591 other followers