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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started