EXPERIMENT NUMBER:12
TITLE: To Study and Interface Traffic Light Controller Using PPI 8255
APPARATUS: 1. 8086 Trainer kit 2. Key board 3. SMPS
CIRCUIT DESCRIPTION:
In this Traffic light module one square is shown which has four ends called East, West, North & South.
The Traffic light module is interface with Port A and Port C of 8255. Port A is connected with North and
South LEDs. Port C is connected with East and West LEDs. Each end has LED called STOP, START,
GO STRAIGHT & GO LEFT.
North: PA7-GO LEFT , PA6-GO STR , PA5- START, PA4-STOP
South: PA3-GO LEFT , PA2-GO STR, PA1-START , PA0-STOP
East: PC7-GO LEFT, PC6-GO STR, PC5-START, PC4-STOP
West: PC3-GO LEFT, PC2-GO STR,PC1-START, PC0-STOP
Traffic Light Controller:
8255 Port Addresses
Port A -70H
Port B -72H
Port C -74H
Control Word -76H
Program:
This Program Controls Traffic Light of one square. By Changing the delay between Two Signals one
can change the speed of traffic.
Flowchart:
Start
Initialize PA & PC as output
Set all square in stop mode using PA0, PA1,PC0, PC4 bit
Delay for 10 m-sec
Set GO-STR LED of N&S poles using PA2 & PA6 bit & clear STOP B
LED of N&S Pole using PA0 &PA4 Bit
Delay for 10 m-sec
Set START LED of N&S poles using PA1 & PA5 Bit & clear GO-STR
LED of N&S pole using PA2 & PA6 Bit
Delay for 5 m-sec.
Set STOP LED of N&S poles using PA0 & PA4 bit, set Go Left LED
of N&S pole using PA3&PA7 Bit, clear start LED of N&S Pole using
PA1 &PA5 bit
Set START LED of N&S poles using PA1 & PA5 bit & Clear Go-Left
LED of N&S pole using PA3 & PA7 Bit
Delay for 5 m-sec.
Set GO-STR LED of E&W poles using PC2&PC6 bit, clear STOP
LED of E&W pole using PC0&PC4 bit ,clear START LED of N&S
pole using PA1 & PA5 bit
A
A
Delay for 10 m-sec.
Set START LED of E&W poles using PC1 & PC5 bit & clear GO-STR
LED of E & W pole using PC2 & PC6 bit
Delay for 5 m-sec.
Set STOP LED of E &W poles using PC0 & PC4 bit, Set GO-LEFT LED
of E & W pole using PC3 & PC7 bit ,clear START LED of E & W pole
using PC1 & PC5 bit
Set START LED of E & W poles using PC1 & PC5 bit & clear GO-
LEFT LED of E & W pole using PC3 & PC7 bit
Delay for 5 m-sec
Clear START LED of E & W pole using PC1 & PC5 BIT
B
Address Opcode Mneumonics Comments
0400 B0 80 MOV AL,80H ;INIT 8255 CWR
0402 E6 76 OUT 76H,AL ;SET ALL PORTS(OUTPUT)
0404 B0 11 MOV AL,11H ;SET ALL SQUARE RED
0406 E6 70 OUT 70H,AL ;OUT AT PORT- A
0408 E6 74 OUT 74H,AL ;OUT AT PORT- C
040A E8 42 00 CALL DELAY 1 ;CALL DELAY 10msec
040D B0 44 UP:MOV AL,44H ;SET GREEN LED OF N& S
040F E6 70 OUT 70H,AL ;SET RED LED OF E,W
0411 E8,3B,00 CALL DELAY1 ;CALL DELAY 10 MSEC
0414 B0 22 MOV AL,22H ;SET YELLOW OF N&S
0416 E6 70 0UT 70H,AL ;OUT AT PORT -A
0418 E8 41 00 CALL DELAY 2 ;CALL DELAY 5 MSEC
041B B0 99 MOV AL,99H ;SET ALL SQUARE RED
041D E6 70 OUT 70H,AL ;SET GREEN(GO LEFT
LED)
041F E8 2D 00 CALL DELAY 1 ;CALL DELAY 5 MSEC
0422 B0 22 MOV AL,22H ;SET YELLOW LED N&S
0424 E6 70 OUT 70H,AL ;OUT AT PORT-A
0426 E8 33 00 CALL DELAY 2 ;CALL DELAY 5 MSEC
0429 B0 11 MOV AL,11H ;SET ALL SQUARE RED
042B E6 70 OUT 70H,AL ;OUT AT PORT-A
042D B0 44 MOV AL,44H ;SET GREEN OF E&W
042F E6 74 OUT 74H,AL ;OUT AT PORT-C
0431 E8 1B 00 CALL DELAY 1 ;CALL DELAY 10 MSEC
0434 B0 22 MOV AL,22H ;SET YELLOW LED E&W
0436 E6 74 OUT 74H,AL ;OUT AT PORT-C
0438 E8 21 00 CALL DELAY 2 ;CALL DELAY 5MSEC
043B B0 99 MOV AL,99H ;SET ALL SQUARE RED
043D E6 74 OUT 74H,AL ;SET GREEN OF E&W
043F E8 0D 00 CALL DELAY1 ;CALL DELAY 10 MSEC
0442 B0 22 MOV AL,22H ;SET YELLOW LED E&W
0444 E6 74 OUT 74H,AL ;OUT AT PORT -C
0446 E8 13 00 CALL DELAY 2 ;CALL DELAY 5 MSEC
0449 B0 11 MOV AL,11H ;SET ALL SQUARE RED
044B E6 74 OUT 74H,AL ;OUT AT PORT-C
044D EB BE JMP UP ;JUMP TO START
044F BB 0F 00 DELAY1:MOV BX,000FH ;10 MSEC DELAY ROUTINE
0452 B9 FF FF DL2:MOV CX,0FFFFH
0455 49 DL1:DEC CX
0456 75 FD JNZ DL1
0458 DB DEC BX
0459 75 F7 JNZ DL2
045B C3 RET
045C BB 05 00 DL2:MOV BX,0005H ;5 MSEC DELAY ROUTINE
045F B9 FF FF DL4:MOV CX,0FFFFFH
0462 49 DL3:DEC CX
0463 75 FD JNZ DL3
0465 4B DEC BX
0466 75 F7 JNZ DL4
0468 C3 RET
CONCLUSION: Program to control Traffic light at one square executed and output is verified.