Turn-key PCB assembly services in prototype quantities or low-volume to mid-volume production runs

Arduino timer interrupt tutorial

Operating microcontrollers without interrupts is very inefficient. One of common used microcontrollers among hobbyists id AVR. Starters probably would go with Arduino board where AVR Atmega168/328 is used. It doesn’t matter weather you are programming in Arduino style or plain C it is advised to use interrupts. EngBlaze has written a tutorial on programming AVR timers using interrupts. tutorial thoroughly goes through all information you may need including: what is timer, types of timers and finally running them in various modes. Once timers are set most of work is done in hardware with short interrupt routines where changes can be made. If you interested more about timers we have written couple tutorials on programming them using C. Continue reading

AVR timers do more than count time

Probably Timer/Counters are one of the most complex peripherals in microcontrollers, but as fact, they are most common and no matter what complexity program is. Designers of timers have put a lot of thought in them making them very flexible, versatile for all timing dependent tasks like measuring periods, generating PWM signals, generating output signals and timed interrupts. Timers run independently from AVR core. Once set, they do their silent job while AVR can do other tasks or go to sleep. AVR can read timer values, or change operation modes whenever it needs or only can be interrupted with several available interrupts. If you see an application where the frequency is measured, music is generated or motor is driven – there is timer involved. Continue reading