模拟交通灯控制完整系统文档格式.docx
《模拟交通灯控制完整系统文档格式.docx》由会员分享,可在线阅读,更多相关《模拟交通灯控制完整系统文档格式.docx(11页珍藏版)》请在冰豆网上搜索。
6)要求为该系统设计一个直流5V单电源供电的稳压电路,保障系统的正常运行。
4、电路原理图
5、参考电路板图
6、装配图
7、制作实物照片
8、参考程序
ORG0000H
LJMPMAIN
ORG000BH;
T0中断服务程序入口
LJMPT0FW
ORG0030H
MAIN:
MOV30H,#15
MOV40H,#15
MOV36H,#00H
MOV46H,#0FFH
MOVTMOD,#01H
MOVTH0,#3CH
MOVTL0,#0B0H
MOVR1,#20
SETBET0
SETBEA
SETBTR0
STAR:
ACALLDISP
ACALLDEL
AJMPSTAR
DISP:
PUSHA
MOVDPTR,#TAB
MOVA,40H
MOVB,#10
DIVAB
MOV50H,A
MOV51H,B
MOV54H,A
MOV55H,B
MOVA,30H
MOV52H,A
MOV53H,B
MOV56H,A
MOV57H,B
MOVR5,#8
MOVR0,#50H
LOOP:
MOVA,@R0
MOVCA,@A+DPTR
MOVSBUF,A
JNBTI,$
CLRTI
INCR0
DJNZR5,LOOP
MOVR2,36H
CJNER2,#0,N1;
36H=1,跳到N1,绿灯亮
CLRP1.0;
否则36H=0,红灯亮
CLRP2.0
SETBP1.1
SETBP2.1
SETBP1.2
SETBP2.2
AJMPN2
N1:
CLRP1.2;
N1,绿灯亮
CLRP2.2
SETBP1.0
SETBP2.0
N2:
MOVR2,30H
CJNER2,#3,N3;
30H>
<
3,跳到N3,
CLRP1.1;
否则30H=3,黄灯亮
CLRP2.1
clrP3.2
SETBP3.2
N3:
CJNER2,#2,N4;
2,跳到N4,
否则30H=2,黄灯亮
N4:
CJNER2,#1,N5;
1,跳到N5,
否则30H=1,黄灯亮
N5:
MOVR2,46H
CJNER2,#0,N6;
46H=1,跳到N6,绿灯亮
CLRP1.5;
否则46H=0,红灯亮
CLRP2.5
SETBP1.4
SETBP2.4
SETBP1.3
SETBP2.3
AJMPN7
N6:
CLRP1.3;
N6,绿灯亮
CLRP2.3
SETBP1.5
SETBP2.5
N7:
MOVR2,40H
CJNER2,#3,N8;
40H>
3,跳到N8,
CLRP1.4;
否则40H=3,黄灯亮
CLRP2.4
N8:
CJNER2,#2,N9;
2,跳到N9,
否则40H=2,黄灯亮
N9:
CJNER2,#1,N10;
1,跳到N10,
否则40H=1,黄灯亮
N10:
POPA
RET
TAB:
DB11H,0D7H,32H,92H,0D4H
DB98H,18H,0D3H,10H,90H,0C4H
DEL:
MOVR7,#200;
125.775mS
DEL1:
MOVR6,#240
DJNZR6,$
DJNZR7,DEL1
T0FW:
DJNZR1,EXIT0
CLREA
DJNZ30H,M1
MOVA,36H
CPLA
mov36H,A
;
AJMPEXIT
M1:
DJNZ40H,EXIT
MOVA,46H
mov46H,A
EXIT:
EXIT0:
RETI
END