Вы находитесь на странице: 1из 1

Traffic Light Controller

The microcomputer can be used to control the traffic lights. Let us consider a microprocessor
based traffic light controller on a single main road. It provides three traffic lights(Green,
Yellow and Red) and two pedestrian signs (Walk and Dont walk). These traffic lights are
interfaced with the microprocessor by PortA(mode 0) of 8255A. The ON/OFF times for the
traffic signals and pedestrian signs are given in the tables.
Lights Bit
Assignment
ON time in
sec
Green PA
0
45
Yellow PA
1
5
Red PA
2
25
Walk PA
3
25
Dont walk PA
4
50

Time
in sec
Dont
Walk
Walk Red Yellow Green Data
byte
PA
7
PA
6
PA
5
PA
4
PA
3
PA
2
PA
1
PA
0

45 0 0 0 1 0 0 0 1 11H
5 0 0 0 1 0 0 1 0 12H
25 0 0 0 0 1 1 0 0 0CH

The green light and the Dont walk sign can be turned on by sending data byte 11H to the
output port (Port A). The 45 seconds delay can be provided by using a 1second subroutine
and a counter with a count 45
10 .
Similarly, the next two bytes 12H and 0CH will turn
ON/OFF the appropriate lights/signs. The necessary time delays are provided by changing
the values of count in the counter.

Вам также может понравиться