OBJECTIVE: To develop traffic light control program using the traffic light control module
(available in the lab).
COMPONENTS USED:
Intel 8085 microprocessor programming kit.
Traffic light controller interface board.
Power supply (AC 230 Mains).
Instructions Set.
DESCRIPTION:
Creating a traffic light control program in 8085 assembly language involves simulating the
operation of a traffic light with the 8085 microprocessor. The traffic light transitions
between Red, Green, and Yellow states with appropriate delays. We can adjust the delay
values as needed to control the duration of each state. This program will control the traffic
lights by setting the appropriate port pins on the 8085 microprocessor.
To use this program, we will need to interface the traffic lights to the 8085 microprocessor
using a programmable peripheral interface (PPI) chip such as the 8255. Once the traffic
lights are interfaced to the microprocessor, we can load the program into the
microprocessor and run it. The traffic lights will then be controlled automatically by the
program.
PROCEDURE:
The program is used to control the led’s of the traffic light controller board. The steps
of the program can be described through the following steps:
All the ports of the 8085 are initialized as output ports.
Load the required pin address in accumulator for north to south traffic
movement and send to port A and port B.
Delay subroutine is called for a delay of 2 seconds.
Again load the required pin address into accumulator for turning all the lanes yellow
and send to port A and port B.
Delay subroutine is called for a delay of 2 seconds.
Load the required pin address into accumulator for east and west traffic
movement and send this to port A and port B.
Again Delay subroutine is called.
Step 4 is repeated again and simultaneously Delay subroutine is called.
Jump instruction is initialized to go to step 2.
This Program will run continuously until the traffic light controller kit is connected to
the microprocessor.
PORT ADDRESSES:
PORT A – 40H: To control the south and east led lights.
18H: Red light ON, Green and Yellow OFF.
88H: Green light ON, Red and Yellow OFF.
44H: Yellow light On, Red and Green OFF.
PORT B – 41H: To control the north and west led lights.
18H: Red light ON, Green and Yellow OFF.
88H: Green light ON, Red and Yellow OFF.
44H: Yellow light On, Red and Green OFF.
PORT C – 42H: To glow the outside led’s.
CONTROL REGISTER – 43H: To set the control word in output mode. DELAY
SUBROUTINE PROCEDURE:
Loading the count (FFFF) to give 0.5 seconds delay.
Decrementing the counter
Moving the components of D to Accumulator A
Checking whether the count is 0.( ORA E)
Check for 0; If YES decrement register C, if NO jump to decrementing the
counter.
Again check for Zero, if YES return to main program, if NO jump to loading the
counter.
FLOWCHART :
MAIN PROGRAM:
Address Mnemonics code
8000 MVI A,80H 3E
8001 80
8002 OUT 43H D3
8003 43
8004 MVI A, 81H 3E
8005 81
8006 OUT 40H D3
8007 40
8008 MVI A, 88H 3E
8009 88
800A OUT 41 H D3
800B 41
800C CALL DELAY CD
800D 00
800E 81
800F MVI A, 44H 3E
8010 44
8011 OUT 40H D3
8012 40
8013 OUT 41H D3
8014 41
8015 CALL DELAY CD
8016 00
8017 81
8018 MVI A, 88H 3E
8019 88
801A OUT 40H D3
801B 40
801C MVI A, 81H 3E
801D 81
801E OUT 40H D3
801F 40
8020 CALL DELAY CD
8021 00
8022 81
8023 MVI A, 44H 3E
8024 44
8025 OUT 40H D3
8026 40
8027 OUT 41H D3
8028 41
8029 CALL DELAY CD
802A 00
802B 81
802C MVI A, 18H 3E
802D 18
802E OUT 40H D3
802F 40
8030 MVI A, 88H 3E
8031 88
8032 OUT 41H D3
8033 41
8034 CALL DELAY CD
8035 00
8036 81
8037 MVI A,44H 3E
8038 44
8039 OUT 40H D3
803A 40
803B OUT 41H D3
803C 41
803D CALL DELAY CD
803E 00
803F 81
8040 MVI A, 88H 3E
8041 88
8042 OUT 40H D3
8043 40
8044 MVI A ,18H 3E
8045 18
8046 OUT 41H 3E
8047 41
8048 CALL DELAY CD
8049 00
804A 81
804B MVI A, 44H 3E
804C 44
804D OUT 40H D3
804E 40
804F OUT 41H D3
8050 41
8051 CALL DELAY CD
8052 00
8053 81
8054 JMP 8004 C3
8055 04
8056 80
DELAY SUBROUTINE:
Address Mnemonics Code
8100 MVI B, 07H 06
8101 07
8102 MVI C, FF H 0E
8103 FF
8104 MVI D, FF H 16
8105 FF
8106 DCR D 15
8107 JNZ 8106 C2
8108 06
8109 81
810A DCR C 0D
810B JNZ 8104 C2
810C 04
810D 81
810E DCR B 05
810F JNZ 8102 C2
8110 02
8111 81
8112 RET C9
RESULTS: