Description
● Introduction to Interrupt & Timer
Video(Interrupt): https://youtu.be/VawuidtuOuk Video2(Timer): https://youtu.be/ERbznytxgmo
● Lab requirements:
● Basic (70%):
○ Description: Initially, blink 4 LEDs with the following order: RA0 -> RA2. When clicking RB0 button, the order will become RA1 -> RA3. After clicking RB0 button again, it will go back to the original order. Repeat it ! Every LED should be on for 0.5 seconds.
○ Example:
RA0 -> RA2
-click-> RA1 -> RA3 -click-> RA0-> RA2 ○ Standard of grading:
1. Use ISR to handle the button event.
2. Button: RB0, 4 LEDs: RA0~RA3.
3. Write in Assembly.
● Advanced (30%) :
○ Description: Blink 4 LEDs with the following order: RA0 -> RA1 -> RA2 -> RA3. In the first round, every LED should be on for 0.5 second. In the second round, every LED should be on for 1 seconds. Repeat it ! You must use TIMER2 to create the proper delay interval. You are not allowed to use DELAY macro.
○ Example:
RA0 -> RA1 -> RA2 -> RA3 ( 0.5s )
-> RA0 -> RA1 -> RA2 -> RA3 ( 1s ) -> RA0 -> RA1 -> RA2 -> RA3 ( 0.5s ) ○ Standard of grading:
1. Don’t use DELAY macro int this program.
2. 4 LEDs: RA0~RA3.
3. Write in Assembly.
4. Explain how timer2 can trigger the interrupt every interval.
● Bonus (20%):
○ Description: Initially, blink 4 LEDs with the following order: RA0 -> RA1 -> RA2 -> RA3. Every LED should be on for 1 seconds. When clicking RB0 button, every LED should be on
0.5 seconds. After clicking RB0 again, every LED should be on 0.25 seconds. Then clicking RB0 again, it will go back to 1
second. When clicking RB0 button, change the blinking direction immediately
○ Example:
RA0 -> RA1 -> RA2 ( 1s )
–click-> RA1 -> RA0 -> RA3 -> RA2 -> RA1 ( 0.5s )
–click-> RA2 -> RA3 -> RA0 -> RA1 -> RA2 ( 0.25s ) –click-> RA1 -> RA0 -> RA3 -> RA2 -> RA1 … (1s ) ○ Standard of grading:
1. Use ISR to handle the button event.
2. Button: RB0, 4 LEDs: RA0~RA3.
3. Write in Assembly.
Reviews
There are no reviews yet.