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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 單片機中斷實驗2

          單片機中斷實驗2

          作者: 時間:2016-11-21 來源:網(wǎng)絡 收藏
          電路圖:

          代碼如下:
          #include
          #include
          sbit p1_0 = P1^0;
          sbit p1_1 = P1^1;
          void delay (void) {
          int a = 500;
          while(a--) _nop_();
          }
          void LED_01() interrupt 0 using 1 {
          delay();
          if (INT0 == 0) {
          p1_0 = !p1_0;
          while (INT0 == 0);
          }
          }
          void LED_02() interrupt 2 using 1 {
          delay ();
          if (INT1 == 0) {
          p1_1 = !p1_1;
          while (INT1 == 0);
          }
          }
          void main () {
          p1_0 = 0;
          p1_1 = 0;
          EA = 1;
          EX0 = 1;
          EX1 = 1;
          while(1);
          }



          關鍵詞: 單片機中斷實

          評論


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