visit http://blog.vinu.co.in/2012/03/multitasking-in-avr-atmega32.html for more details of this work...