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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 各種單片機中斷程序的寫法

          各種單片機中斷程序的寫法

          作者: 時間:2016-12-02 來源:網(wǎng)絡(luò) 收藏
          //////////////////// 下面是PIC單片機中斷的寫法!///////////////////////////////////////////////////////////

          #include
          __CONFIG(0x1832); //寫配置位
          volatile char i; //中斷用到的變量須要用volatile修飾一下

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

          void main()
          {

          }

          void interrupt tt() //中斷服務(wù)程序,不用申明
          {

          }

          ////////////////////////////////////////// 下面AVR單片機GCC中斷程序的寫法 /////////////////////////////////////////////

          #include<avr/io.h>
          #include
          volatile char i; //中斷用到的變量須要用volatile修飾一下

          int main(void) //GCC編寫的主函數(shù)是要用int型的函數(shù)
          {
          sei(); //開總中斷
          }

          SIGNAL(SIG_INTERRUPT0) //外部中斷0
          {

          }
          SIGNAL(SIG__INTERRUPT1) //外部中斷1
          {

          }
          SIGNAL(SIG_OVERFLOW1) //定時器1溢出中斷
          {

          }

          SIGNAL(SIG_ADC)//ADC中斷的

          {

          }

          /////////////////////////////////// 下面是AVR單片機的ICC中斷程序?qū)懛ǎ?//////////////////////////////////////////////////

          #include
          volatile char i; //中斷用到的變量須要用volatile修飾一下
          #pragma interrupt_handler miao:9
          #pragmadata:code
          const table[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d, 0x07,
          0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};

          void main()
          {
          SREG|=(1<<7); //開總中斷
          }

          void miao() //中斷服務(wù)程序
          {

          }



          關(guān)鍵詞: 單片機中斷程

          評論


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