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

          新聞中心

          LED顯示計(jì)數(shù)

          作者: 時(shí)間:2016-11-21 來(lái)源:網(wǎng)絡(luò) 收藏
          電路圖:
          程序?qū)崿F(xiàn)功能:
          每次按下芯片右下角的按鍵,LED顯示按鍵按下的次數(shù),代碼如下:
          #include
          sbit P3_7=P3^7;
          unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
          char count;
          void delay(unsigned int time){
          unsigned int j = 0;
          for(;time>0;time--)
          for(j=0;j<125;j++);
          }
          void main(void) {
          count=0; //計(jì)數(shù)器賦初值
          P0=table[count/10]; //P0口顯示初值
          P2=table[count]; //P2口顯示初值
          while(1) { //進(jìn)入無(wú)限循環(huán)
          if(P3_7==0){ //軟件消抖,檢測(cè)按鍵是否壓下
          delay(10);
          if(P3_7==0) { //若按鍵壓下
          count++; //計(jì)數(shù)器增1
          if(count==100) //判斷循環(huán)是否超限
          count=0;
          P0=table[count/10]; //P0口輸出顯示
          P2=table[count]; //P2口輸出顯示
          while(P3_7==0); //等待按鍵松開(kāi),防止連續(xù)計(jì)數(shù)
          }
          }
          }
          }



          關(guān)鍵詞: LED顯示計(jì)

          評(píng)論


          技術(shù)專(zhuān)區(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); })();