Question: Connect a Red LED on PD0, Green LED on PD1 and Yellow LED on PD2. Set up and use Timer 0 to interrupt the CPU

Connect a Red LED on PD0, Green LED on PD1 and Yellow LED on PD2. Set up and use Timer 0 to interrupt the CPU every 50 ms. The interrupt service routine should perform the following. Make Red LED blink at a rate of 1 Hz, Green LED at a rate of 2 Hz and the Yellow LED at a rate of 5 Hz. Note that all LED changes should happen from the interrupt service routine by toggling the LEDs at appropriate times. Hint: You will need a global variable to keep track of how much time has passed. Your main() function code will setup the port, timer and interrupt and then perform a while (1) doing nothing. You should not use loops or delays in the ISR.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!