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

TRAFFIC LIGHT CONTROLLER

Using 8085 Microprocessor


SALIL MATHUR

T
his unique traffic light control- to a particular direction. For instance, Consequently, the probability of confu-
ler makes simple use of assem- if one desires to move towards sion leading to an accident is reduced.
bly language programming north, east or west from south, he is Addition of an externally initiated
with Intel 8085 microprocessor. It provided with a single light trap for emergency provisions (for po-
permits accident-free control, as a accomodating red, amber and green lice, ambulance, fire brigade or VIPs)
separate set of signals has been assigned signals for the respective directions. is a sophisticated feature, which can

Software sometime (Stage 2).


602D 3E, 2B MVI A, 2BH Now the traffic of east and west
The program starts from memory location 6000. 602F D3, 00 OUTPORT 00 directions has to be allowed. So
ADDR OP MNEMONICS INSTRUCTIONS 6031 D3, 08 OUTPORT 08 before that outports 00 and 08
CODE 6033 CD, 1661 CALL 6116 have to be given alert signal for a
6000 CD, 5061 CALL 6150 This data calls a program on delay of 5 seconds.
memory location 6150. 6036 3E, AA MVI A, AAH Moving data AAH corresponds to
6003 3D, AA MVI A, AAH Moving data AAH into port A(01) 6038 D3, 00 OUTPORT 00 all red in north and south
6005 D3, 01 OUTPORT 01 and port B(09) of IC 8255(1) 603A D3, 08 OUTPORT 08 directions.
6007 D3, 09 OUTPORT 09 and IC 8255(2) respectively,
corresponds to all three signals 603C 3E, FE MVI A, FEH This data alerts traffic in east
indicating stop in east and west 603E D3, 01 OUTPORT 01 (outport 09) and west (outport 01)
directions (Stage 1). 6040 D3, 09 OUTPORT 09 directions of the next coming
6009 3E, FE MVI A, FEH This data alerts traffic in north 6042 CD, 1661 CALL 6116 change and a delay of 5 seconds
600B D3, 00 OUTPORT 00 (outport 08) and south (outport 00) has been called.
600D D3, 08 OUTPORT 08 directions of the next coming 6045 3E, 16 MVI A, 16H Now, accomulator holds data 16H,
600F CD, 1661 CALL 6116 change. So a delay (five seconds) 6047 D3, 01 OUTPORT 01 which corresponds to two green
subroutine at 6116 has been 6049 D3, 09 OUTPORT 09 signals from E to W, E to S and
called. 604B CD, 0061 CALL 6100 W to E, W to N. However, the W
6012 3E, 16 MVI A, 16H Now, accomulator holds data to S and E to N are red, as it may
6014 D3, 00 OUTPORT 00 16H, which corresponds to two lead to an accident. Here delay of
6016 D3, 08 OUTPORT 08 green signals from N to E, N to 30 seconds has been called to
6018 CD, 0061 CALL 6100 S and from S to W, S to N. allow traffic movement (Stage 3).
However, N to W and S to E are 604E 3E, FF MVI A, FFH This data alerts traffic in east and
red, as it will lead to an accident. 6050 D3, 01 OUTPORT 01 west directions of the next
Here a delay (30 seconds) 6052 D3, 09 OUTPORT 09 coming change so a delay
subroutine at 6100 has been called 6054 CD, 1661 CALL 6116 (5 seconds) subroutine at 6116 has
to allow traffic to pass. been called.
601B 3E, FF MVI A, FFH This data allows introduction of
601D D3, 00 OUTPORT 00 amber signal prior to alternation 6057 3E, 29 MVI A, 29H Moving data 29H allows diagonal
601F D3, 08 OUTPORT 08 of any signal, so that the moving 5059 D3, 01 OUTPORT 01 movement from E to N and W to S
6021 CD, 1661 CALL 6116 and stopped vehicle can be alerted 605B D3, 09 OUTPORT 09 for a delay of 30 seconds
of any change change in signal. 605D CD, 0061 CALL 6100 (Stage 4).
Use of delay subroutine again for
5 seconds allows the vehicle to 6060 3E, 2B MVI A, 2BH Now, traffic of north and south
judge and prepare for further 6062 D3, 01 OUTPORT 01 directions has to be allowed. So
signalling. 6064 D3, 09 OUTPORT 09 before that alert signal is given
6024 3E, 29 MVI A, 29H The data allows diagonal 6066 CD, 1661 CALL 6116 to traffic in east and west
6026 D3, 00 OUTPORT 00 movement from S to E (outport 00) directions for 5 seconds.
6028 D3, 08 OUTPORT 08 and N to W (outport 08). The long 6069 C3, 0060 JMP 6000 At this address, the control
602A CD, 0061 CALL 6100 delay (30 seconds) at 6100 has transfers to the beginning of the
been called again to enable the main program for repetition.
signal at these outports to stay for (Continued on page 13)

ELECTRONICS PROJECTS 11
NOTE: TWO LEFT-MOST BITS ARE BEING NEGLECTED,
AS ONLY SIX PORTS ARE USED FOR EACH DIRECTION.

Fig. 1: General view of the traffic control system. Fig. 2: Bit position of the ports.

NOTE: PORTS 00 AND 01 ARE OF IC 8255(1)


PORTS 08 AND 09 ARE OF IC 8255(2).

Fig. 3: Interface of LEDs to ports of ICs 8255.

12 ELECTRONICS PROJECTS
Fig. 4: Different stages showing traffic flow.

(Continued from page 11) Delay subroutine for 30 seconds:


The data at location 6000 calls a program starting from memory ADDR OP MNEMONICS INSTRUCTIONS
location 6150 which is as follows: CODE
ADDR OP MNEMONICS INSTRUCTIONS 6100 06, 64 MVI B, 64H This delay subroutine uses three
CODE 6102 0E, FF MVI C, FFH registers B, C and D, where
6150 3E, 80 MVI A, 80H This program moves data 80H 6104 16, FF MVI D, FFH contents of B register can be
6152 D3, 03 OUTPORT 03 into accumulator, so that the 6106 15 DCR D varied to change the time delay.
6154 D3, 0B OUTPORT 0B control ports 03 and 0B of IC 6107 C2, 0661 JNZ 6106 Here 64H gives a delay of around
6156 3E, FE MVI A, FEH 8255(1) and IC 8255(2) respectively 610A 0D DCR C 30 seconds. Total time delay
6158 32, 5220 STA 2052 are initialised. The 610B C2, 0461 JNZ 6104 =TD=T0+TL
615B 3E, 61 MVI A, 61H address 61FE is stored at memory 610E 05 DCR B TL=Given T states x T (clock
615D 32, 5320 STA 2053 location 2052 (lower byte of 610F C2, 0261 JNZ 6102 period) x count
6160 C9 RETURN address) and 2053 (higher byte 6112 C9 RETURN T0=Delay outside the loop.
of address). (Continued on page 14)

ELECTRONICS PROJECTS 13
(Continued from page 13) 611C 15 DCR D for this time period. The control
Delay subroutine for 5 seconds: 611D C2, 1C61 JNZ 611C shifts to the main program
ADDR OP MNEMONICS INSTRUCTIONS 6120 0D DCR C when encountered with return
CODE 6121 C2, 1A61 JNZ 611A statement.
6116 06, 14 MVI B, 14H This subroutine provides a 6124 05 DCR B
6118 0E, FF MVI C, FFH delay of around 5 seconds. Thus, 6125 C2, 1861 JNZ 6118
611A 16, FF MVI D, FFH the amber alert signal stays on 6128 C9 RETURN

be remote-controlled also. Whenever the trap is externally button switch.


triggered, the control goes into 0024H Practical implementation of the
in monitor program where it gets above concept is feasible using SCRs
Emergency provision signal of jumping to location 2052H. and triacs as relays, which control the
At the program starting from memory Thereafter, the control transfers to set of bulbs for a particular stage. These
location 6150, we have stored 61FE address 61FE which contains the solidstate relays are triggered by sig-
at locations 2052 and 2053, respect- emergency subroutine. The trap signal nals from different ports of the micro-
ively. This is for emergency provision. can be initiated through a push- processor.

ADDR OP MNEMONICS INSTRUCTIONS 622E 0E, FF MVI C, FFH


CODE 6230 3E, FF MVI A, FFH
61FE 16, 30 MVI D, 30H Here at 61FE, a pulse train of sound 6232 D3, 02 OUTPORT 02
6200 3E, 80 MVI A, 80H wave for fixed interval, correspond- 6234 D3, 0A OUTPORT 0A
6202 D3, 03 OUTPORT 03 ing to desired frequency is given at 6236 CD, 8662 CALL 6286
6204 D3, 0B OUTPORT OB port C (02,0A) of IC 8255 for 6239 3E, 00 MVI A, 00H
6206 3E, AA MVI A, AAH 45 seconds, after which the 623B D3, 02 OUTPORT 00
6208 D3, 00 OUTPORT 00 control transfers to the main 623D D3,0A OUTPORT 0A
620A D3, 01 OUTPORT 01 program. 623F CD, 8662 CALL6286
620C D3, 08 OUTPORT 08 6242 0D DCR C
620E D3, 09 OUTPORT 09 6243 C2, 3662 JNZ 6236
6210 0E, 80 MVI C, 80H 6246 15 DCR D
6212 3E, FF MVI A, FFH 6247 C2, 0062 JNZ6200
6214 D3, 02 OUTPORT 02 624A C3, 0060 JMP6000
6216 CD, 8062 CALL 6280
6219 3E, 00 MVI A, 00H Blinking lights at each port are achieved by giving data of red and no
621B D3, 0A OUTPORT 0A signal, for small times, using the two delay subroutines at:
621D CD, 8062 CALL 6280 ADDR OP CODE MNEMONICS
6220 0D DCRC 6280 06, FF MVI B, FFH
6221 C2, 1262 JNZ 6212 6282 05 DCR B
6224 3E, 00 MVI A, 00H 6283 C2, 8262 JNZ6282
6226 D3, 00 OUTPORT 00 6286 06,80 MVI B, 80
6228 D3, 01 OUTPORT 01 6288 05 DCR B
622A D3, 08 OUTPORT 08 6289 C2, 8862 JNZ 6288
622C D3, 09 OUTPORT 09 628C C9 RETURN

14 ELECTRONICS PROJECTS

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