<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          關(guān) 閉

          新聞中心

          EEPW首頁(yè) > 工控自動(dòng)化 > 設(shè)計(jì)應(yīng)用 > 用單片機(jī)89C2051制作的延時(shí)控制器

          用單片機(jī)89C2051制作的延時(shí)控制器

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

          KEY:SJMP MAIN1
          SJMP KEY1 ;依次為:KEY值+2,4,6,8,因?yàn)镾JMP占2個(gè)字節(jié)
          SJMP KEY2 ;S1的KEYCODE=02H,S2: KEYCODE=04H
          SJMP KEY3 ;S3: KEYCODE=06H, S4: KEYCODE=08H
          SJMP KEY4
          KEY1:CLR TR0;時(shí)計(jì)數(shù)器加1
          MOV A,THBIN
          CLR C
          ADDC A,#01H
          MOV THBIN,A
          SUBB A,#24;24D
          JC KEY11
          MOV THBIN,#00H
          KEY11: SJMP MAIN1
          NOP
          KEY2:CLR TR0;分計(jì)數(shù)器加1
          MOV A,TMBIN
          CLR C
          ADDC A,#01H
          MOV TMBIN,A
          SUBB A,#60;60D
          JC KEY21
          MOV TMBIN,#00H
          KEY21: SJMP MAIN1
          NOP
          KEY3:CLR TR0;秒計(jì)數(shù)器加1
          MOV A,TSBIN
          CLR C
          ADDC A,#01H
          MOV TSBIN,A
          SUBB A,#60;60D
          JC KEY31
          MOV TSBIN,#00H
          KEY31: SJMP MAIN1
          NOP
          KEY4:MOV TH0,#0DCH;退出校時(shí)狀態(tài)
          MOV TL0,#00H
          SETB TR0
          SJMP MAIN1

          本文引用地址:http://www.ex-cimer.com/article/162125.htm

          ; ********** 顯示子程序 **************
          ORG 0200H
          DISPLY: MOV A,TSBIN;秒計(jì)數(shù)器調(diào)入A
          MOV B,#0AH
          DIV AB ;秒計(jì)數(shù)值÷10 (結(jié)果十位存于A,個(gè)位存于B)
          SWAP A
          ORL A,#07H;顯示秒的十位
          MOV P1,A
          MOV A,#DPS1
          ANL A,OUT
          MOV P3,A
          ACALL DSPDEL;(顯示時(shí))0.5ms
          MOV C,P3.7;讀S4按鍵狀態(tài)
          MOV A,#HIDE
          ANL A,OUT
          MOV P3,A
          JC NP1
          MOV KEYCODE,#08H;S4按下,鍵盤值=8
          NP1:MOV P1,#0F7H;消隱
          NOP
          NOP
          NOP
          MOV A,B;顯示秒的個(gè)位
          SWAP A
          ORL A,#07H
          MOV P1,A
          MOV A,#DPS0
          ANL A,OUT
          MOV P3,A
          ACALL DSPDEL
          MOV A,#HIDE
          ANL A,OUT
          MOV P3,A
          NOP
          NOP
          NOP
          MOV A,TMBIN;
          MOV B,#0AH
          DIV AB;
          SWAP A;顯示分的十位
          ORL A,#07H
          MOV P1,A
          MOV A,#DPM1
          ANL A,OUT
          MOV P3,A
          ACALL DSPDEL
          MOV C,P3.7;檢測(cè)S2是否按下
          MOV A,#HIDE
          ANL A,OUT
          MOV P3,A
          JC NP2
          MOV KEYCODE,#04H;S2按下,鍵盤值=4
          NOP
          NP2:MOV P1,#0F7H;消隱
          NOP
          NOP
          MOV A,B
          SWAP A;顯示分的個(gè)位
          ORL A,#07H
          MOV P1,A
          ;MOV C,KEYPRE
          ;MOV P1.3,C
          SETB P1.3
          MOV A,#DPM0
          ANL A,OUT
          MOV P3,A
          ACALL DSPDEL
          MOV C,P3.7;判斷S3是否按下
          MOV A,#HIDE
          ANL A,OUT
          MOV P3,A



          評(píng)論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();