USEING A PIC16F877A board You are to design, code, and implement a program that
ID: 649314 • Letter: U
Question
USEING A PIC16F877A board
You are to design, code, and implement a program that reads two input switches and blinks an LED (your choice) according to the following truth table:
SW7-2
SW7-1
LED on time
LED off time
OFF
OFF
500 mS
500 mS
OFF
ON
1000 mS
1000 mS
ON
OFF
500 mS
1000 mS
ON
ON
1000 mS
500 mS
For the time base, you are to set up a timer that interrupts the processor every 10 mS. In order to verify that your interrupt is working correctly, designate a port pin as an output, and toggle it every time the timer ISR is run. Connect the pin to the oscilloscope so that you can verify it is exactly 10 mS on, and 10 mS off.
To save CPU cycles, SW7 inputs should be set up to only be read on a change of value. This can be done by using the interrupt-on-change feature of RB4-RB7.
You are free to select any valid port pins to drive the LED, and output the square wave produced by the timer ISR.
SW7-2
SW7-1
LED on time
LED off time
OFF
OFF
500 mS
500 mS
OFF
ON
1000 mS
1000 mS
ON
OFF
500 mS
1000 mS
ON
ON
1000 mS
500 mS
Explanation / Answer
Program to Blink Two LED
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.