C51本征函数库介绍
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
本征函数(intrinsicroutines)是指编译时直接将固定代码插入当前行,而不用ACALL和LCALL
来实现(无需堆栈操作?),可大大提高函数的访问效率.
函数原型
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);
产生一个nop指令
extern bit_testbit_ (bit);
产生一个JBC指令,若该位置位,返回1,否则为0;只能作用于直接寻址的位变量,不能用于表达式
之中
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);
测试并返回float的状态
一下摘自keil C51的帮助文档
0 Standard floating-point numbers 标准浮点数
1 Floating-point value 0 浮点数0
2 +INF (positive overflow) 正溢出
3 -INF (negative overflow) 负溢出
4 NaN (Not a Number) error status出错