led blinking using led using atmega8

Status
Not open for further replies.
Use timer to generate interrupt for some milli seconds and then use a counter to count no of interrupts. eg. set timer interrupt for 100 ms and increment counter on every interrupt. If counter is 10 then time is 1000 ms or 1 sec. When value of counter is 10 set a flag. use this flag in while(1) loop to blink led and clear the flag. The led toggles on every 10 interrupts.


Edit: Debasis. Thanks I didn't see the interrupt0

You have to use externel interrupt. When ever an interrupt is detected you have to blink led and then re-enable the interrupt which you have disabled in interrupt routine.
 
Last edited:

you have mentioned that led blink using interrupt0.so,remember that interrupt0 is a hardware interrput by which u can active the interruput by giving a zero pulse to the interrupt0 pin,then you can blink the led using 0 and 1 pulse by help of programe
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…