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

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > c51中的intrins.h庫函數(shù)

          c51中的intrins.h庫函數(shù)

          作者: 時間:2016-11-23 來源:網(wǎng)絡 收藏
          #ifndef __INTRINS_H__
          #define __INTRINS_H__

          extern void _nop_ (void);
          extern bit _testbit_ (bit);
          extern unsigned char _cror_ (unsigned char, unsigned char);
          extern unsigned int _iror_ (unsigned int, unsigned char);
          extern unsigned long _lror_ (unsigned long, unsigned char);
          extern unsigned char _crol_ (unsigned char, unsigned char);
          extern unsigned int _irol_ (unsigned int, unsigned char);
          extern unsigned long _lrol_ (unsigned long, unsigned char);
          extern unsigned char _chkfloat_(float);

          #endif

          1怎么用C51寫一個NOP語句呢?
          把頭文件intrins.h包含進來,然后在需用NOP處調(diào)用_nop_();函數(shù)即可。
          頭文件intrins.h包含進來,然后在需用NOP處調(diào)用_nop_();函數(shù)即可。

          2.c51中的intrins.h庫函數(shù)
          _crol_ 字符循環(huán)左移
          _cror_ 字符循環(huán)右移
          _irol_ 整數(shù)循環(huán)左移
          _iror_ 整數(shù)循環(huán)右移
          _lrol_ 長整數(shù)循環(huán)左移
          _lror_ 長整數(shù)循環(huán)右移
          _nop_ 空操作8051 NOP 指令
          _testbit_ 測試并清零位8051 JBC 指令

          詳解:

          函數(shù)名: _crol_,_irol_,_lrol_
          原 型: unsigned char _crol_(unsigned char val,unsigned char n);
          unsigned int _irol_(unsigned int val,unsigned char n);
          unsigned int _lrol_(unsigned int val,unsigned char n);
          功 能:_crol_,_irol_,_lrol_以位形式將val 左移n 位,該函數(shù)與8051“RLA”指令
          相關(guān),上面幾個函數(shù)不同于參數(shù)類型。
          例:
          #include
          main()
          {
          unsigned int y;
          C-5 1 程序設計 37
          y=0x00ff;
          y=_irol_(y,4);
          }

          函數(shù)名: _cror_,_iror_,_lror_
          原 型: unsigned char _cror_(unsigned char val,unsigned char n);
          unsigned int _iror_(unsigned int val,unsigned char n);
          unsigned int _lror_(unsigned int val,unsigned char n);
          功 能:_cror_,_iror_,_lror_以位形式將val 右移n 位,該函數(shù)與8051“RRA”指令
          相關(guān),上面幾個函數(shù)不同于參數(shù)類型。
          例:
          #include
          main()
          {
          unsigned int y;
          y=0x0ff00;
          y=_iror_(y,4);
          }

          函數(shù)名: _nop_
          原 型: void _nop_(void);
          功 能:_nop_產(chǎn)生一個NOP 指令,該函數(shù)可用作C 程序的時間比較。C51 編譯器在_nop_
          函數(shù)工作期間不產(chǎn)生函數(shù)調(diào)用,即在程序中直接執(zhí)行了NOP 指令。
          例:
          P()=1;
          _nop_();
          P()=0;

          函數(shù)名: _testbit_
          原 型:bit _testbit_(bit x);
          功 能:_testbit_產(chǎn)生一個JBC 指令,該函數(shù)測試一個位,當置位時返回1,否則返回0。
          如果該位置為1,則將該位復位為0。8051 的JBC 指令即用作此目的。
          _testbit_只能用于可直接尋址的位;在表達式中使用是不允許的


          關(guān)鍵詞: c51intrins.h庫函

          評論


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