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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 輸出1K方波信號(輸出兩路,相位相反)

          輸出1K方波信號(輸出兩路,相位相反)

          作者: 時間:2016-11-26 來源:網(wǎng)絡(luò) 收藏
          //晶振為12M,2007/12/24
          //此程序在硬件上調(diào)試通過
          //此程序是應(yīng)一個網(wǎng)友而寫,希望多提寶貴意見
          #include
          sbit output0=P3^0; //輸出方波,頻率為1K
          sbit output1=P3^1; //輸出方波,頻率為1K,與 output1相位相反
          sbit output3=P3^3;//一直輸出高電平
          //開關(guān)為P3.2這里不列出,全部用P3口,這樣確保所用的四個功能腳,
          //都在51單片機(jī)(40腳)的一側(cè)
          void t0int() interrupt 1//定時器0定時50MS,
          {
          TR0=0;
          TH0=0xfe;//0.5ms定時常數(shù)
          TL0=0x0c;
          TR0=1;
          output1=output0;
          output0=~output0;

          }
          void e0int() interrupt 0//用外部中斷0作控制開關(guān)
          {
          TR0=!TR0;//關(guān)閉或打開定時器,從而停止輸出信號或繼續(xù)信號
          }
          void main(void)
          {
          TMOD=0x01;
          EA=1;
          EX0=1;
          ET0=1;
          IT0=1;

          output0=1;
          output1=!output0;
          output3=1;

          TH0=0xfe;
          TL0=0x0c;
          TR0=1;
          while(1);
          }



          評論


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