您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 其它相关文档 > 基于单片机智能路灯的设计PPT
1720单片机数码管倒计时模拟交通灯116031—04娄旭光116031—05孙伟东116031—06宋佩第二组设计内容交通红绿灯控制NO1:A线绿灯亮,B线红灯亮,倒计时20秒;NO2:A线黄灯闪烁,B线红灯亮,倒计时3秒;NO3:A线红灯亮,B线绿灯亮,倒计时20秒;NO4:A线红灯亮,B线黄灯闪烁,倒计时3秒。设计要求倒计时控制:倒计时显示可以提醒驾驶员在信号灯灯色发生的时间,在“停止”和“通过”两者间作出合适的选择。倒计时显示是用来减少驾驶员在信号灯色改变的关键做出复杂判断的,可以提醒驾驶员发生改变的时间。第一部分最小系统最小系统构成:单片机、晶振电路和复位电路、电源电路1电路元器件包括:AT89S52单片机、电容、晶振、电阻、电源接口2电路图3程序清单ORG0000HAJMPSTARTORG0030HSTART:MOVP0,#0FFHLCALLDELAYMOVP0,#00HLCALLDELAYSJMPSTARTDELAY:MOVR5,#10DEL:MOVR6,#200DEL1:MOVR7,#123NOPDEL2:DJNZR6,DEL2DJNZR7,DEL1DJNZR5,DELRETEND第二部分交通灯控制1电路元器件包括:最小系统元件、排阻、LED灯、按钮开关、电阻、74HC5732电路图ORG0000HAJMPSTARTORG0003HAJMPINTTOORG0030HSTART:CLRITOSETBEASETBEX0MOVR0,#10L1:MOVP0,#0C1HLCALLDELAY_500MSDJNZR0,L1MOVR1,#3L2:MOVR0,#21HLCALLDELAY_500MSMOVP0,#01HLCALLDELAY_500MSDJNZR1,L2MOVR2,#10L3:MOVP0,#1CHLCALLDELAY_500MSDJNZR2,L33程序清单MOVR3,#3L4:MOVP0,#12HLCALLDELAY_500MSDJNZR3,L4AJMPSTARTINTTO:MOVR4,#10L5:MOVP0,#11HLCALLDJNZ-500MSDJNZR4,L5RETIDELAY_500MS:MOVR5,#10DEL:MOVR7,#1200DEL1:MOVR6,#123NOPDEL2:DJNZR6,DEL2DJNZR7,DEL1RETEND第三部分显示控制1电路元器件包括:数码管2电路图UNIT_BUFEQU50HDECA_BUFEQU51HORG0000HAJMPMAINORG000BHLJMPINTT0ORG0030HMAIN:MOVP2,#0FFHMOVP1,#0FFHMOVP1,#00HMOVR7,#20MOVR6,#21MOVTMOD,#01HMOVTH0,#3CHMOVTL0,#0B0HSETBEASETBET0SETBTR0LOOP:LCALLDISPLAYSJMPLOOPINTT0:DJNZR7,NT0MOVR7,#20DECR6NT0:MOVTH0,#3CHMOVTL0,#0B0HSETBTR0RETI3程序清单DISPLAY:MOVDPTR,#TABLEMOVA,R6MOVB,#10DIVABMOVDECA_BUF,AMOVUNIT_BUF,BMOVA,UNIT_BUFMOVCA,@A+DPTRMOVP2,AMOVP1,#08HLCALLDELAY_10MSMOVA,DECA_BUFMOVCA,@A+DPTRMOVP2,AMOVP1,#04HLCALLDELAY_10MSRETTABLE:DB0FCH,60H,0DAH,0F2H,66H,0B6H,0BEH,0E0H,0FEH,0F6HDELAY_10MS:MOVR5,#05HDELAY1:MOVR4,#64HDELAY2:DJNZR4,DELAY2DJNZR5,DELAY1RETEND第四部分交通灯倒计时显示控制包括:AT89S52单片机、数码管、74HC5731电路元器件2电路图ALEABCDEFGDPALEABCDEFGDP1234ALE2134XTAL218XTAL119ALE30EA31PSEN29RST9P0.0/AD039P0.1/AD138P0.2/AD237P0.3/AD336P0.4/AD435P0.5/AD534P0.6/AD633P0.7/AD732P1.0/T21P1.1/T2EX2P1.23P1.34P1.45P1.56P1.67P1.78P3.0/RXD10P3.1/TXD11P3.2/INT012P3.3/INT113P3.4/T014P3.7/RD17P3.6/WR16P3.5/T115P2.7/A1528P2.0/A821P2.1/A922P2.2/A1023P2.3/A1124P2.4/A1225P2.5/A1326P2.6/A1427U1AT89C52234567891RP1RESPACK-8D02D13D24D35D46D57D68D79Q019Q118Q217Q316Q415Q514Q613Q712LE11OE1U274HC573R1R2R3R4R5R6R7R8D1LED-REDD2LED-YELLOWD3LED-GREEND4LED-GREEND5LED-REDD6LED-YELLOWD7LED-GREEND8LED-GREEND02D13D24D35D46D57D68D79Q019Q118Q217Q316Q415Q514Q613Q712LE11OE1U374HC573R171kR181kR191kR201k倒计时交通灯主程序流程图3程序清单EW_UNIT_BUFEQU50HEW_DECA_BUFEQU51HNS_UNIT_BUFEQU52HNS_DECA_BUFEQU53HSEGMENT_CODEEQUP2BIT_CODEEQUP1COUNT_REGISTEREQUR7EW_COUNT_VALUEEQUR6NS_COUNT_VALUEEQUR3EW_REDBITP0.0EW_YELLOWBITP0.1EW_GREENBITP0.2NS_REDBITP0.4NS_YELLOWBITP0.5NS_GREENBITP0.6ORG0000HAJMPMAINORG000BHLJMPINTT0ORG0030HMAIN:MOVP0,#0FFHMOVP1,#0FFHMOVP2,#0FFHMOVP2,#00HMOVBIT_CODE,#00HMOVCOUNT_REGISTER,#20MOVTMOD,#01HMOVTH0,#3CHMOVTL0,#0B0HSETBEASETBET0SETBTR0STATE1:MOVEW_COUNT_VALUE,#20MOVNS_COUNT_VALUE,#17MOVP0,#00HSETBEW_REDSETBNS_GREENSTATE2:LCALLDISPLAYCJNENS_COUNT_VALUE,#00H,STATE2MOVNS_COUNT_VALUE,#3CLRNS_GREENSETBNS_YELLOWSTATE3:LCALLDISPLAYCJNEEW_COUNT_VALUE,#00H,STATE3MOVNS_COUNT_VALUE,#20CLRNS_YELLOWSETBNS_REDMOVEW_COUNT_VALUE,#17CLREW_REDSETBEW_GREENSTATE4:LCALLDISPLAYCJNEEW_COUNT_VALUE,#00H,STATE4MOVEW_COUNT_VALUE,#3CLREW_GREENSETBEW_YELLOWSTATE5:LCALLDISPLAYCJNEEW_COUNT_VALUE,#00H,STATE5SJMPSTATE1INTT0:DJNZCOUNT_REGISTER,NT0MOVCOUNT_REGISTER,#20DECEW_COUNT_VALUEDECNS_COUNT_VALUENTO:MOVTH0,#3CHMOVTLO,OBOHSETBTR0RETIDISPLAY:MOVDPTR,#TABLEMOVA,EW_COUNT_VALUEMOVB,#10DIVABMOVEW_DECA_BUF,AMOVEW_UNIT_BUF,BMOVA,EW_UNIT_BUFMOVCA,@A+DPTRMOVSEGMENT_CODE,AMOVBIT_CODE,#02HLCALLDELAY_1MSMOVA,EW_DECA_BUFMOVCA,@A+DPTRMOVSEGMENT_CODE,AMOVBIT_CODE,#01HLCALLDELAY_1MSMOVA,NS_COUNT_VALUEMOVB,#10DIVABMOVNS_DECA_BUF,AMOVNS_UNIT_BUF,BMOVA,NS_UNIT_BUFMOVCA,@A+DPTRMOVSEGMENT_CODE,AMOVBIT_CODE,#08HLCALLDELAY_1MSMOVA,NS_DECA_BUFMOVCA,@A+DPTRMOVSEGMENT_CODE,AMOVBIT_CODE,#04HLCALLDELAY_1MSRETTABLE:DB0FCH,60H,0DAH,0F2H,66H,0B6H,0BEH,0E0H,0FEH,0F6HDELAY_1MS:MOVR5,#5DELAY1:MOVR4,#100DELAY2:DJNZR4,DELAY2DJNZR5,DELAY1RETEND谢谢观看
本文标题:基于单片机智能路灯的设计PPT
链接地址:https://www.777doc.com/doc-4992905 .html