Wednesday 28 September 2011

Traffic Light


8051 MICROCONTROLLER BASED EXPERIMENT (SIMPLE CONTROL APPLICATIONS)
                                                                               TRAFFIC LIGHT CONTROLLER
AIM:
            To write an assembly language program to control the traffic light signal using the microprocessor 8085
APPARATUS REQUIRED:
                                    8051 kit, power chord
THEORY:
                        A simple contraption of a traffic control system is shown in the figure where the signaling lights are simulated by the blinking or ON – OFF control of LED’s.  The signaling lights for the pedestrian crossing are simulated by the ON – OFF control of dual colour LED’s.
                        A model of a four road – four lane junction, the board has green, yellow and red LED’s which are the green, orange and red signals of an actual systems. 12 LEDs are used on the board.  In addition 8 dual colour LEDs are used which can be made to change either to red or to green.
                        The control of the LEDs is as follows:
                        The board communicates with the microprocessor trainer by means of a 26 core cable which is connected to the output pins of any parallel port of trainer.
                        The outputs (i.e. port) are the inputs to buffers 7406 whose outputs drive the LEDs.  The buffered output applied to the cathode of the LEDs decides whether it is ON or OFF.                   
  
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
410A
410B
410C
410D
410E
410F
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
411A

SUBROUTINE

411B
411C
411D
411E
411F
4120
4121


4122
4123

4124
4125
4126

4127

4128
4129

412A
412B
412C
21
00
45
0E
0C
7E
D3
0F
23
7E
D3
0C
23
7E
D3
0D
CD
1B
41
23
0D
C2
09
41
C3
00
41


C5
0E
05
11
FF
FF
1B


7A
B3

C2
21
41

0D

C2
1E

41
C1
C9
START








LOOP1



















DELAY

LOOP3


LOOP2













LXI


MVI

MOV
OUT

INX
MOV
OUT

INX
MOV
OUT


CALL

DELAY
DCR
JNZ


JMP




PUSH
MVI

LXI


DCX


MOV
ORA

JNZ



DCR

JNZ



POP
RET

H, 4500 H


C, OC H

A, M
OF H

H
A, M
OC H

H
A, M
OD H


DELAY

H
C
LOOP 1


START




B
C, 05

D, FFFF


D


A, D
E

LOOP 2



C

LOOP 3



B
Initialize the HLReg. Pair to 4500 H

Initialize the count Reg.  C to OC H
Initialize the ports of 8255.


Send the data to switch ON / OFF
The LED’s through port A.
Switch ON / OFF the LED’s through port B



Call the subroutine delay
Get the next data and decrement the count.
If the count is not zero go to instruction labeled “LOOP 1”
Jump unconditionally to the instruction labeled “START”


Save the contents of BC Reg. Pair to stack pointer.
Initialize Reg. C to hold data 05 H.
Get the data FFFF H in DE Reg. Pair.
Decrement the content of DE Reg. Pair
Check whether the contents of DE Reg. Pair is zero.
If the contents of DE Reg. Pair is not zero go to instruction labeled LOOP 2
Decrement the content of Reg. C
If the contents of Reg. C is not zero go to instruction labeled “LOOP 3”
Move the contents of stack pointer to BC Reg. Pair
Return to the main program.




RESULT:
Thus an ALP  to control the traffic light signal was written and executed.

0 comments:

Post a Comment