purpose of this lab is to control the outputs of the micro-controller in a given
ID: 1715737 • Letter: P
Question
purpose of this lab is to control the outputs of the micro-controller in a given sequence. Green and red Light Emitting Diodes (LEDs) are connected to the micro-controller outputs.
Steps
First, write a program to turn on only one LED and then turn off the same LED.
Improve the program by making the LED blink.
The next part of the lab is to read the input switches, one from the Walk push button and the other indicating a car at the crossing. As switches are mechanical objects, some de-bounce time (dead time) will also be placed in the program. You will control each LED with one switch; as long as the switch is active the respective LED is ON and when switch is inactive, the corresponding LED is OFF. Then, the LED will be made to blink as long as switch is ON.
Finally, you will write a little traffic light controller where the green or red stays ON while the corresponding switch is ON. If more than one switch is activated, then ON the red light.
LED's simulate the traffic lights and the switches simulate the walk push button and the car presence sensor at a crossroad.
Input and Output Assignment
P3.1 pin 19 active Low Input, SW1 (Walk push button)
P3.2 pin 18 active Low Input, SW2 (Car present at the crossing))
P1.3 pin 9 Output active High, Red LED
P1.1 pin 11 Output, active High, Green LED
The term active low indicates that the micro-controller must be programmed in a manner such that the switch is made or activated when P3.2 or P3.1 read low logic.
Correspondingly the term active high means that to activate an LED the
corresponding
microcontroller pin must generate high logic. The port directional register defines the state (input or output) of the micro-controller I/O lines.
Explanation / Answer
ORG 0000h
loop:
CLR P2.0
CALL DELAY
SETB P2.0
CALL DELAY
JMP loop
const int LED1 = 12;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.