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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > PIC讀書筆記4:中斷函數(shù)注意事項(xiàng)

          PIC讀書筆記4:中斷函數(shù)注意事項(xiàng)

          作者: 時(shí)間:2016-09-05 來源:網(wǎng)絡(luò) 收藏

            1:名稱

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

            例如Timer1

            void __attribute__ ((interrupt)) _T1Interrupt (void)

            {

            //interrupt service roution code here..

            }

            函數(shù)名_T1Interrupt并不是隨意選擇的,她是向量表中預(yù)先定義的Timer1中斷標(biāo)志符,并且在連接器腳本中需要加載代碼,加載的是“.gld”文件。

            C30編譯器中用到的__attribute__(())機(jī)制是用于說明特殊功能的C語言擴(kuò)展功能。個(gè)人認(rèn)為這種語法又長又難讀。推薦使用include文(.h)件里的宏定義,這樣可以大大提高代碼的可讀性。下面代碼與上面功能一樣。使用宏_ISR_實(shí)現(xiàn):

            void _ISR _T1Interrupt (void)

            {

            //interrupt service roution code here..

            }

            2:關(guān)于中斷代碼長度:

            冗長的計(jì)算應(yīng)該放在主函數(shù)中,而不是放在中斷服務(wù)程序中。



          關(guān)鍵詞: PIC 中斷

          評(píng)論


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