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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 基于單片機的頻率計的設計(C51語言)

          基于單片機的頻率計的設計(C51語言)

          作者: 時間:2016-11-26 來源:網(wǎng)絡 收藏
          // 用定時器1定時,使用方式一,晶振頻率為11.0592MHZ,常數(shù)為4C00;

          //用外部中斷一計數(shù),每中斷一次,count加一

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

          //使用P1口接的八個發(fā)光二極管顯示

          //本程序為一個網(wǎng)友應邀而寫,在硬件上測試通過,在低頻率時,效果不錯.

          #include
          unsignedint t1oc=20;//5000;
          unsignedintcount=0,precount;
          void display(unsigned int dis)
          {
          P1=dis;//顯示語句
          }
          void t1int() interrupt 3
          {
          TR1=0;
          t1oc--;
          TH1=0x4c;//72;//56;
          TL1=0x00;//72;//56;
          if(t1oc==0)
          {
          t1oc=20;//5000;
          precount=count;
          count=0;
          }
          TR1=1;
          }
          void int0int() interrupt 0
          {

          EX0=1;
          count++;
          EX0=0;
          }
          void main(void)
          {
          TMOD=0x10;//0x20;
          TH1=0x4c;//72;//56;
          TL1=0x00;//72;//56;
          EA=1;
          EX0=1;IT0=1;
          ET1=1;
          TR1=1;
          while(1)
          {
          display(precount);
          }
          }



          評論


          技術專區(qū)

          關閉
          看屁屁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); })();