Professional Documents
Culture Documents
Objective
1. To design , build and program a microprocessor or microcontroller band system
2. To construct a prototype for 4 way Traffic light controller using a microprocessor.
Block diagram
8085
8255 PPI
Traffic light
North/ South
Port A
East / West
Port B
Block diagram 1
The first block shows a 8085 microprocessor. Microprocessors is known as a mass storage
device. They are very advanced forms of computers. They are also called microcomputers. The impact
of microprocessor in different lures of fields are very significant. Microprocessors are available of
low cost, low power and small weight, computing capability makes it useful in different applications.
Now a days, a microprocessor based systems are used in instructions, automatic testing product, speed
control of motors, traffic light control , and light control furnace.. It is very useful in the field of
instrumentation. Frequency counters, function generators, frequency synthesizers, spectrum analyses
and many other instruments are available, when microprocessors are used as controller. It is also used
in medical instrumentation. (255 interfacing - 8085 Microprocessor Course. 2015. 8255 interfacing
- 8085 Microprocessor Course. [ONLINE]
The second block is the 8255 PPI. The 8255A is a general purpose programmable input ouput
device designed for microprocessors. It consists of three 8-bit bidirectional input output ports. The
three ports are PORT A, PORT B & PORT C. Port A contains one 8-bit output latch or buffer and one
8-bit input buffer. Port B is same as PORT A. However, PORT C can be split into two parts PORT C
lower (PC0-PC3) and PORT C upper (PC7-PC4) by the control word. The three ports are divided in
two groups Group A (PORT A and upper PORT C) Group B (PORT B and lower PORT C). The two
groups can be programmed in three different modes. In the first mode (mode 0), each group may be
programmed in either input mode or output mode (PORT A, PORT B, PORT C lower, PORT C
upper). In mode 1, the seconds mode, each group may be programmed to have 8-lines of input or
output (PORT A or PORT B) of the remaining 4-lines (PORT C lower or PORT C upper. (2015. .
[ONLINE])
The block diagram shows the 8085 microprocessor interfacing with the 8255. 8085
microprocessor is defined as a silicon chip embedded with a Central Processing Unit or CPU. It is
also referred to as a computer's logic chip, microchip, and processor. The 8085 microprocessor is
interfaced with 8255 to produce a signal for the traffic light. This is by lowering the order of the 8-bit
address A0-A7 is separated from AD0-AD7 using address latch or known as buffer. The separated
address lines A0-A7 are connected to A0-A7 input pins of 8255 and the separated data bus D0-D7 are
connected to D0-D7 pins of 8255. The reset output of 8085 is connected to the reset output of 8255.
8255 does not have internal (separate) control logic generator, hence the IO/M(bar), RD(bar) and
WR(bar) control signals are not connected directly to 8255. These pins are 1st given to decoder and
decoded using 3:8 decoder (Ex: IC 74138). The generated control signals IOR(bar) and IOW(bar) are
connected to RD(bar) and WR(bar) input of 8155. An active low signal of chip select logic is
obtained decoding remaining address lines of lower order addresses A2- A7. (Applications of
Microprocessors. 2015. Applications of Microprocessors. [ONLINE])
Flow chart
Main program
Start
8 seconds delay
(D)
(D) - 1
Is ctr=0?
YES
NO
Decrement
D
Delay program(Green)
10 seconds delay
(D)
(D) - 1
Is ctr=0?
YES
NO
Decrement
D
Program
Firstly the look up table was done for the four junction traffic light.
R
0
0
1
1
1
1
1
1
G
0
0
1
0
0
0
0
0
R
1
1
1
1
0
0
1
1
G
0
0
0
0
0
1
0
0
HEX
HEX
0CH
14H
21H
22H
24H
24H
24H
24H
24H
24H
24H
24H
24H
0CH
14H
21H
22H
24H
Then the main program was determined for the traffic light.
Main program :
Address
Opcod
e
3E
80
D3
43
3E
0C
D3
40
3E
24
D3
41
CD
00
85
3E
14
D3
40
3E
24
D3
Label
Mneumonics
MVI A , 80H
OUT 43H
BEGIN
MVI A , 0CH
OUT 40H
MVI A , 24H
OUT 41H
CALL DELAY 1
L.B
H.B
MVI A , 14 H
OUT 40H
MVI A , 24H
OUT 41H
Comments
41
CD
00
86
3E
24
D3
40
3E
0C
D3
41
CD
00
85
3E
24
D3
40
3E
1A
D3
41
CD
00
86
3E
21
D3
40
3E
24
D3
41
CD
00
85
3E
21
D3
40
3E
24
D3
41
CD
00
86
3E
24
D3
40
3E
CALL DELAY 2
L.B
H.B
MVI A , 21H
OUT 40 H
MVI A , 24H
OUT 41H
CALL DELAY 1
L.B
H.B
MVI A , 22H
OUT 40H
MVI A , 24H
OUT 41H
CALL DELAY 2
MVI A , 24H
OUT 40H
MVI A , 0CH
OUT 40H
CALL DELAY 1
MVI A , 24H
OUT 40H
MVI A , 14H
OUT 41H
CALL DELAY 2
MVI A , 24 H
OUT 40H
MVI A , 21H
21
D3
41
CD
00
85
3E
24
D3
40
3E
22
D3
41
CD
00
86
C3
04
80
OUT 41H
CALL DELAY 1
MVI A , 24H
OUT 40H
MVI A , 22H
OUT 41H
CALL DELAY 2
JMP BEGIN
Opcode
06
05
11
FF
FF
1B
7B
B2
C2
05
85
C2
02
85
C9
Label
DELAY 1
Mnuemonics
MVI B , 05
LOOP 2
LXI D , FFFF
LOOP 1
DCX D
MOV A , E
ORA D
JNZ LOOP 1
DCR B
JNZ LOOP 2
RET
Table 3 : Delay program 1
Comments
Address
Opcode
06
1E
11
FF
FF
1B
7B
B2
C2
05
86
C2
02
86
C9
Label
DELAY 1
Mnuemonics
MVI B , 30
LOOP 2
LXI D , FFFF
LOOP 1
Comments
DCX D
MOV A , E
ORA D
JNZ LOOP 1
DCR B
JNZ LOOP 2
RET
Procedure
1. The look up table for the traffic light was determined for the four junction traffic light ; north ,
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
Hardware
Results
As the program was tested , our objectives were achieved. The traffic light lighted as per the look up
table as below :
R
0
0
G
0
0
HEX
HEX
0CH
14H
21H
24H
24H
24H
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
1
0
0
0
0
1
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
0
1
1
1
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
22H
24H
24H
24H
24H
24H
24H
0CH
14H
21H
22H
24H
The traffic light followed these sequences as it lighted up. The changes were at 5 seconds
each. Then we increased the delay to 10 seconds and observed the traffic light. 10 seconds
seemed to long for it to change so we proceeded with 8 seconds.
After that , we observed that the delay wasnt accurate with the programmed delay. The delay
took more longer time than the programmed delay.
Discussion
The experiment was a success as the traffic lit up according to the look up table. However , as
we were inserting the delay program , few issues were noticed. When the delay program was set at 5
seconds , the delay wasnt actually 5 seconds but 7 seconds. This is because the time the machine
checks for the program allocated in the memory also affects the time of the delay therefore causes the
delay to be longer than the usual. To prove this statement , we tried increasing the delay to 12
seconds , and instead of delaying for 12 seconds , it delayed for 17 seconds.
Besides that , the light lit up according the look up table. However the last part of the look up
table had to be removed. This is due to the that the final part of the look up table was all green. In a
junction theres no light with all red. At least at one corner , the light should be green.
Conclusion
In a nutshell , a traffic light is very important use in our daily lives. To make it a simple , the
8085 microprocessor is used to make it a simple coding for easy understanding. It is also cheap and
affordable. This assignment has made me understand the use of programs , opcodes and how is the
applications of all.
Reference
255 interfacing - 8085 Microprocessor Course. 2015. 8255 interfacing - 8085 Microprocessor Course.
[ONLINE]
Available
at:
http://www.zseries.in/embedded