<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 51單片機模擬交通燈

51單片機模擬交通燈

作者: 時(shí)間:2016-11-29 來(lái)源:網(wǎng)絡(luò ) 收藏

lcall del500ms
setb p1.6 ;關(guān)南北綠燈
clr p1.7 ;南北黃燈亮2秒
mov 34h,#4 ;延時(shí)2秒
loop2:lcall del500ms
djnz 34h,loop2
setb p1.7 ;2秒后滅南北黃燈
clr p2.6 ;5秒后開(kāi)時(shí)間顯示
clr p2.7 ;
mov 31h,#30 ;東西時(shí)間重賦30秒初值
mov 32h,#30 ;南北時(shí)間重賦30秒初值
clr p1.1 ;點(diǎn)亮東西綠燈
clr p1.5 ;點(diǎn)亮南北紅燈
setb p1.0 ;關(guān)東西紅燈
clr 4fh
sjmp out
display:mov a,31h ;東西方向時(shí)間顯示
mov b,#10
div ab
mov 20h,a
mov 21h,b
disp1:mov a,20h
mov dptr,#table
movc a,@a+dptr
mov p0,a
clr p2.0
lcall del1ms
setb p2.0
disp2:mov a,21h
mov dptr,#table
movc a,@a+dptr
mov p0,a
clr p2.1
lcall del1ms
setb p2.1
disp3:mov a,32h ;南北方向時(shí)間顯示
mov b,#10
div ab
mov 22h,a
mov 23h,b
disp4:mov a,22h
mov dptr,#table
movc a,@a+dptr
mov p3,a
clr p2.6
lcall del1ms
setb p2.6
disp5:mov a,23h
mov dptr,#table
movc a,@a+dptr
mov p3,a
clr p2.7
lcall del1ms
setb p2.7
ret
table:db 0c0h,0f9h,0a4h,0b0h,99h,92h,82h,0f8h,80h,90h ;0-9數字
del1ms:mov r7,#10 ;1ms延時(shí)子程序
d1:mov r6,#50
djnz r6,$
djnz r7,d1
ret
del500ms:mov r5,#5 ;500ms延時(shí)子程序
del3:mov r4,#200
del4:mov r3,#250
djnz r3,$
djnz r4,del4
djnz r5,del3
ret
key:jb p1.3,keyout
jnb p1.3,$
clr ea
inc 36h
mov a,36h
cjne a,#2,key4
mov 36h,#00
setb p1.6 ;東西綠燈閃滅3秒
lcall del500ms
clr p1.6
lcall del500ms
setb p1.6
lcall del500ms
clr p1.6
lcall del500ms
setb p1.6
lcall del500ms
clr p1.6
lcall del500ms
setb p1.6 ;滅東西綠燈
clr p1.7 ;東西黃燈亮2秒
mov 33h,#4 ;延時(shí)2秒
loop3:lcall del500ms
djnz 33h,loop3
setb p1.7 ;2秒后滅東西黃燈
setb p1.0 ;關(guān)東西紅燈
setb p1.6 ;關(guān)南北綠燈
clr p1.1 ;開(kāi)西綠燈
clr p1.5 ;開(kāi)南北紅燈
setb ea
sjmp keyout
key4:clr p1.6 ;;開(kāi)南北綠燈
clr p1.0 ;開(kāi)東西紅燈
setb p1.1
setb p1.2
setb p1.3
setb p1.4
setb p1.5
setb p1.7
keyout:ret
end

本文引用地址:http://dyxdggzs.com/article/201611/323549.htm

上一頁(yè) 1 2 下一頁(yè)

關(guān)鍵詞: 51單片機模擬交通

評論


技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>