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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 用定時(shí)的方式控制流水燈亮滅

          用定時(shí)的方式控制流水燈亮滅

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

          #include
          #include
          #define uchar unsigned char
          uchar num=0;
          init();

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

          main() //用定時(shí)的方式控制流水燈亮滅
          {

          init();
          while(1)
          {

          if(num==20) //每1s流水燈左移一次
          {
          P1=_crol_ (P1,1);
          num=0;
          TR0=0;
          TH0=(65536-50000)/256;
          TL0=(65536-50000)%256;
          TR0=1;


          }


          }

          }

          init()
          {
          EA=1;
          ET0=1;
          TMOD=0x01;
          TH0=(65536-50000)/256;
          TL0=(65536-50000)%256;//定時(shí)50ms
          TR0=1;
          P1=0xfe;

          }

          void timer0() interrupt 1
          {
          num++;
          TH0=(65536-50000)/256;
          TL0=(65536-50000)%256;
          }



          關(guān)鍵詞: 定時(shí)流水燈亮

          評(píng)論


          技術(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); })();