You are on page 1of 11

ASSIGNMENT

WIX1003 – COMPUTER SYSTEM AND ORGANIZATION

SEMESTER 1

PREPARED BY:

NAME MATRIX NO

TANG JIA YANG U2102737

NG SU ANN U2102795

PIRVINNESH A/L SUNTHARAM U2102727

LOW JIN SENG S2106733

ZHENG WU BANG S2132122


Introduction

This assignment is basically about a prototype of a computer system that able to control
vehicles in across-junction. We will produce a working demo of a traffic light control system
using a microprocessor or microcontroller system for this 4-way cross-junction. The system that
we designed will allow for an equal chance for vehicles to exit and cross the junction without
causing any accidental collision of vehicles that come from different directions. Each of these
junctions is controlled by tri-color traffic light indicators which are green, yellow, and red. The
controller system in our prototype will control the lighting of this tri-color light indicator granting
each junction the permission to exit and cross the junction. Every vehicle from its own direction
has equal limited time to move at different moments and all the drivers must be able to move
according to the LED signal that we design. We will also design a countdown indicator that
helps users of all junctions to either prepare them to move or to stop their vehicles through LED
light.
Components Connection Diagram of Traffic Light System
Explanation on the traffic light operations

Stage1: The north traffic light turns green, while the rest of the traffic lights turn red. Road 2 vehicles are
permitted to enter roads 3, 5, and 7. The north traffic light switches to yellow for 3 seconds after 7
seconds of green light, then turns red. The automobile is stopped on road 2 by the red light. The time
west for vehicles on road 2 to cross the road is displayed on a countdown display at the north traffic light,
while the time remaining for vehicles on road 4 to cross the road is displayed on a countdown display at
the east traffic light. Stage 2 is reached by the system.

Stage2: The east traffic light becomes green, but the rest of the traffic lights turn red. Road 4 vehicles are
permitted to enter roads 1, 5, and 7. The north traffic light switches to yellow for 3 seconds after 7
seconds of green light, then turns red. The automobile is stopped on road 4 by a red light. The time west
for vehicles on road 4 to cross the road is displayed on a countdown display at the north traffic light, while
the time remaining for vehicles on road 6 to cross the road is displayed on a 10 countdown display at the
east traffic light. Stage 3 is reached by the system.
Stage3: The traffic light at the south turns green, while the others turn red. Road 6 vehicles are permitted
to enter roads 1, 3 and 7. The north traffic light switches to yellow for 3 seconds after 7 seconds of green
light, then turns red. The automobile is stopped on Highway 6 by a red light. The time west for vehicles on
road 6 to cross the road is displayed on a countdown display at the north traffic light, while the time
remaining for vehicles on road 8 to cross the road is displayed on a countdown display at the east traffic
light. Stage 4 is reached by the system.

Stage4: The traffic signal on the west becomes green, while the others turn red. Road 8 vehicles are
permitted to travel on roads 1, 3, and 5. The north traffic light switches to yellow for 3 seconds after 7
seconds of green light, then turns red. The automobile is stopped on road 8 by a red light. The time west
for vehicles on road 8 to cross the road is displayed on a countdown display at the north traffic light, while
the time remaining for vehicles on road 2 to cross the road is displayed on a countdown display at the
east traffic light. Stage 1 is reached by the system.

Pedestrian: When a stage is completed, the system checks to see if the pedestrian button has been
touched. All traffic lights turn red when the button is hit, while the pedestrian light turns green. The
pedestrian green light will switch to red after 5 seconds. The time west for pedestrians to cross the road
will be displayed on the countdown display at all traffic intersections. The system advances to the next
step, which is where it was supposed to be. Stage 1 to the pedestrian to Stage 2 is an example.

Emergency: The system will determine whether the emergency button has been hit. If the emergency
button is pressed, the traffic lights for the road where the emergency button is pressed will turn red, while
the green light for the road where the emergency button is pressed will turn on. The countdown display at
all traffic intersections is still on to show how much time is west for the emergency button to be activated.
After 10 seconds, the traffic will go to the following level, where it should have gone originally. Stage 1 to
emergency (emergency button hit at south, south traffic light turns green, rest turns red) to Stage 2
Sample code

ORG 00h
AJMP MAIN
MAIN: MOV P0, #6DH
MOV P1, #0BFH
MOV P2, #00H
MOV P3, #0FEH
MOV DPTR, #SEGMENT

NORTH: MOV R7, #01H


MOV P0, #0ADH
MOV P1, #0B3H
MOV R0, #0AH
LCALL LONG_DELAY
MOV P0, #0CDH
LCALL SHORT_DELAY
JNB P3.6, PEDESTRIAN
EAST: MOV R7, #02H
MOV P0, #75H
MOV P1, #0B9H
MOV R0, #0AH
LCALL LONG_DELAY
MOV P0, #79H
LCALL SHORT_DELAY

JNB P3.6, PEDESTRIAN


SOUTH: MOV R7, #03H
MOV P0, #6EH
MOV P1, #0BCH
MOV R0, #0AH
LCALL LONG_DELAY
MOV P0, #6FH
MOV P1, #03CH
LCALL SHORT_DELAY
JNB P3.6, PEDESTRIAN
WEST: MOV R7, #04H
MOV P0, #6DH
MOV P1, #0D6H
MOV R0, #0AH
LCALL LONG_DELAY
MOV P1, #0E6H
LCALL SHORT_DELAY
JNB P3.6, PEDESTRIAN
AJMP NORTH

DIS:JNB P3.2, PEDESTRIAN_NORTH


JNB P3.3, PEDESTRIAN_EAST
JNB P3.4, PEDESTRIAN_SOUTH
JNB P3.5, PEDESTRIAN_WEST
RET
PEDESTRIAN: MOV P0, #6DH

MOV P1, #0B0H


SETB P3.0
CLR P3.1
MOV R0, #05H
LCALL PEDESTRIAN_DELAY
SETB P3.1
CLR P3.0
ACALL CHECK1

PEDESTRIAN_NORTH: MOV P0, #0ADH


MOV P1, #0B0H
MOV P3, #0FEH
MOV R0, #08H
LCALL EM_DELAY
JNB P3.6, PEDESTRIAN
ACALL CHECK1

PEDESTRIAN_EAST: MOV P0, #75H


MOV P1, #0B0H
MOV P3, #0FEH
MOV R0, #08H
LCALL EM_DELAY
JNB P3.6, PEDESTRIAN
ACALL CHECK1

PEDESTRIAN_SOUTH: MOV P0, #6EH


MOV P1, #0B0H
MOV P3, #0FEH
MOV R0, #08H
LCALL EM_DELAY
JNB P3.6, PEDESTRIAN
ACALL CHECK1
PEDESTRIAN_WEST: MOV P0, #6DH
MOV P1, #0D0H
MOV P3, #0FEH
MOV R0, #08H
LCALL EM_DELAY
JNB P3.6, PEDESTRIAN
ACALL CHECK1

CHECK1: CJNE R7, #01H, CHECK2


ACALL EAST

CHECK2: CJNE R7, #02H, CHECK3


ACALL SOUTH
CHECK3: CJNE R7, #03H, CHECK4

ACALL WEST
CHECK4: ACALL NORTH
LONG_DELAY: MOV A, R0
MOVC A, @A+DPTR
MOV P2, A
DEC R0
LCALL DIS
CJNE R0, #03H, LONG_DELAY
RET
SHORT_DELAY: MOV A, R0
MOVC A, @A+DPTR
MOV P2, A
DEC R0
LCALL DIS
CJNE R0, #00H, SHORT_DELAY
MOV A, R0
MOVC A, @A+DPTR
MOV P2, A
DEC R0
RET
PEDESTRIAN_DELAY: MOV A, R0
MOVC A, @A+DPTR
MOV P2, A

DEC R0
CJNE R0, #00H, PEDESTRIAN_DELAY
RET
EM_DELAY: MOV A, R0
MOVC A, @A+DPTR
MOV P2, A
DEC R0
CJNE R0, #00H, PEDESTRIAN_DELAY
RET
SEGMENT:DB 0C0h, 0F9h, 0A4h, 0B0h, 99h, 92h, 82h, 0F8h, 80h, 90h,
88h
END
Design Consideration

1. There are 4 traffic lights in our system which are at the top, bottom, left, and right
side of each junction in the intersection in order to reduce overall accidents,
improve traffic flow, and make sure that it is user-friendly.

2. We targeted to provide equal chances for all junctions of the traffic lights to allow
the users to cross and exit a junction by implementing a timer in our traffic lights
system. When a traffic light turns green, it will stay as a green light for 7 seconds
and change to yellow light which lasts for 3 seconds. The red lights will last for 10
seconds and it will only turn green once it reaches its turn, otherwise, it will
remain red for an additional 1o seconds. Moreover, there will be a second delay
in switching the turns of the respective traffic lights. During that 1 second, all the
traffic lights will be red to avoid vehicles crossing and to ensure users from all
sides stop their vehicles.

3. The countdown timer will help users from all sides to prepare themself to stop or
to go. This will definitely reduce the number of rear-end collisions that happen too
often because of users' carelessness.

4. To ease the pedestrians we also considered a feature in our traffic lights that
allow the pedestrians to cross the roads. They have to press a button to make all
the traffic lights turn red, after a certain amount of time. Pedestrians will have 5
seconds to cross while all the junctions are stopped.

5. To ease the ambulance, the traffic light operators are able to manually adjust the
traffic light systems where all traffic lights will turn red except for the one with the
ambulance on it. Once the ambulance successfully passes the intersection, it will
take a certain amount of time for the traffic light to return to its normal time based
system in the next state.
System Limitations

The traffic light project has some defects in terms of its design. Firstly, the time allocated
for each light is not feasible in the real world. Due to presentation purposes, we had to
allocate 7 seconds for the red light, 3 seconds for the yellow light, and 10 seconds for
the green light. It allows only 2 or 3 cars to pass through the traffic light in each cycle.
Drivers will be irritated by the short-timer, which does not even allow 5 vehicles to cross
every time.

Second, the pedestrian scenario does raise some possible concerns. One of the issues
is the 5 seconds timer, which does not account for individuals who are disabled and
require more time to cross the road. Another issue with this situation is that all traffic
lights at each junction will become red and stay that way for a set period. The issue is
that what if the pedestrian crossing consists of only one or two people? As a result, all
of the vehicles stayed stopped at their respective junctions for an unduly long period,
waiting for their turn to cross.

You might also like