新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > keil C51中的本征函數(shù)庫及使用說明

keil C51中的本征函數(shù)庫及使用說明

作者: 時(shí)間:2016-11-18 來源:網(wǎng)絡(luò) 收藏
本征函數(shù)(intrinsicroutines)是指編譯時(shí)直接將固定代碼插入當(dāng)前行,而不用ACALL和LCALL

來實(shí)現(xiàn)(無需堆棧操作?),可大大提高函數(shù)的訪問效率.

本文引用地址:http://m.butianyuan.cn/article/201611/315687.htm


函數(shù)原型
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);
頭文件
#include

說明

extern void _nop_ (void);
產(chǎn)生一個(gè)nop指令

extern bit_testbit_ (bit);
產(chǎn)生一個(gè)JBC指令,若該位置位,返回1,否則為0;只能作用于直接尋址的位變量,不能用于表達(dá)式

之中

extern unsigned char _cror_ (unsigned char val, unsigned char n);
(unsigned char)val右移n位

extern unsigned int _iror_ (unsigned int val, unsigned char n));
(unsigned int)val右移n位

extern unsigned long _lror_ (unsigned long val, unsigned char n));
(unsigned long)val右移n位

extern unsigned char _crol_ (unsigned char val, unsigned char n));
(unsigned char)val左移n位

extern unsigned int _irol_ (unsigned int val, unsigned char n));
(unsigned int)val左移n位

extern unsigned long _lrol_ (unsigned long val, unsigned char n));
(unsigned long)val左移n位

extern unsigned char _chkfloat_(float);
測(cè)試并返回float的狀態(tài)
一下摘自keil C51的幫助文檔
0 Standard floating-point numbers 標(biāo)準(zhǔn)浮點(diǎn)數(shù)
1 Floating-point value 0 浮點(diǎn)數(shù)0
2 +INF (positive overflow) 正溢出
3 -INF (negative overflow) 負(fù)溢出
4 NaN (Not a Number) error status出錯(cuò)


參考文獻(xiàn)
李軍等編著.51系列單片機(jī)高級(jí)實(shí)例開發(fā)指南.北京-北京航空航天大學(xué)出版社 2004
keil software,inc. C51 users guide



評(píng)論


技術(shù)專區(qū)

關(guān)閉