Putting multitasking on an AVR

[vinod] wanted to familiarize himself with AVR assembly programming, but wanted to do something a little more ambitious than simply blinking an LED. While the completed build does blink a few LEDs, we love that e decided to implement multitasking on his microcontroller.

The program [vinod] came up with uses round robin scheduling to give one of the seven programmed tasks a little bit of compute time every time a timer is triggered. Although it’s extremely simple compared to “real-life” real-time operating systems like VxWorks, it’s still an impressive achievement.

In the video after the break, [vinod] shows off his task-switching with seven LEDs. The white LED is a PWM task, while the six other LEDs are simple toggling tasks  that switch a LED on and off at set intervals independent of each other. This would be hard – if not impossible – to do without some sort of scheduling. Nice work, [vinod].

[Read more…]