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

          新聞中心

          EEPW首頁(yè) > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)LED程序之二,利用定時(shí)器PWM實(shí)現(xiàn)LED的漸亮

          單片機(jī)LED程序之二,利用定時(shí)器PWM實(shí)現(xiàn)LED的漸亮

          作者: 時(shí)間:2016-11-24 來源:網(wǎng)絡(luò) 收藏
          程序來自網(wǎng)絡(luò),稍微修改了一下。
          #include
          sbit LED_0 = P0^0;
          sbit LED_1 = P0^7;
          unsigned Count = 0;
          unsigned i = 0;
          void Time_Init();
          void main(void)
          {
          Time_Init();
          LED_0 = 0;
          LED_1 = 1;
          while(1);
          }
          void Time_Init(void)
          {
          TMOD = 0x02; //¶¨Ê±Æ÷0, ·½Ê½2
          TH0 = 0x9C;
          TL0 = 0x9C;
          EA = 1;
          ET0 = 1;
          TR0 = 1;
          }
          void INT_Time0() interrupt 1 using 1
          {
          Count++;
          i++;
          if (Count == 100) {Count = 0;}
          if (1 + i == 99) {i = 0;}
          if (Count > 1 + i)
          {
          LED_0 = 1;
          LED_1 = 0;
          }
          else
          {
          LED_0 = 0;
          LED_1 = 1;
          }
          }


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