Keil C51库函数(转)
来源:互联网 发布:tensorflow 二次元 编辑:程序博客网 时间:2024/04/28 20:39
第一节 本征库函数(intrinsic routines)和非本征证库函数
C51强大功能及其高效率的重要体现之一在于其丰富的可直接调用的库函数,多使用库函数使程序代码简单,结构清晰,易于调试和维护,下面介绍C51的库函数系统。 C51提供的本征函数是指编译时直接将固定的代码插入当前行,而不是用ACALL和LCALL语句来实现,这样就大大提供了函数访问的效率,而非本征函数则必须由ACALL及LCALL调用。 C51的本征库函数只有9个,数目虽少,但都非常有用,列如下: _crol_,_cror_:将char型变量循环向左(右)移动指定位数后返回 _iror_,_irol_:将int型变量循环向左(右)移动指定位数后返回 _lrol_,_lror_:将long型变量循环向左(右)移动指定位数后返回 _nop_: 相当于插入NOP _testbit_: 相当于JBC bitvar测试该位变量并跳转同时清除。 _chkfloat_: 测试并返回源点数状态。 使用时,必须包含#inclucle <intrins.h>一行。 如不说明,下面谈到的库函数均指非本征库函数。 第二节 几类重要库函数 1. 专用寄存器include文件 2. 绝对地址include文件absacc.h 3. 动态内存分配函数,位于stdlib.h中 4. 缓冲区处理函数位于“string.h”中 memccpy memchr memcmp memcpy memmove memset 这样很方便地对缓冲区进行处理。 5. 输入输出流函数,位于“stdio.h”中 第三节 Keil C51库函数原型列表 1. CTYPE.H bit isalpha(char c); bit iscntrl(char c); bit isdigit(char c); bit isgraph(char c); bit islower(char c); bit isprint(char c); bit ispunct(char c); bit isspace(char c); bit isupper(char c); bit isxdigit(char c); bit toascii(char c); bit toint(char c); char tolower(char c); char __tolower(char c); char toupper(char c); char __toupper(char c); 2. INTRINS.H unsigned char _cror_(unsigned char c,unsigned char b); unsigned char _chkfloat_(float ual); unsigned int _irol_(unsigned int i,unsigned char b); unsigned int _iror_(unsigned int i,unsigned char b); unsigned long _irol_(unsigned long l,unsigned char b); unsigned long _iror_(unsigned long L,unsigned char b); void _nop_(void); bit _testbit_(bit b); 3. STDIO.H char _getkey(void); char *gets(char * string,int len); int printf(const char * fmtstr[,argument]…); char putchar(char c); int puts (const char * string); int scanf(const char * fmtstr.[,argument]…); int sprintf(char * buffer,const char *fmtstr[;argument]); int sscanf(char *buffer,const char * fmtstr[,argument]); char ungetchar(char c); void vprintf (const char *fmtstr,char * argptr); void vsprintf(char *buffer,const char * fmtstr,char * argptr); 4. STDLIB.H int atoi(void * string); long atol(void * string); void * calloc(unsigned int num,unsigned int len); void free(void xdata *p); void init_mempool(void *data *p,unsigned int size); void *malloc (unsigned int size); int rand(void); void *realloc (void xdata *p,unsigned int size); void srand (int seed); 5. STRING.H void *memchr (void *buf,char c,int len); char memcmp(void *buf1,void *buf2,int len); void *memcopy (void *dest,void *SRC,int len); void *memmove (void *dest,void *src,int len); void *memset (void *buf,char c,int len); char *strcat (char *dest,char *src); char *strchr (const char *string,char c); char strcmp (char *string1,char *string2); char *strcpy (char *dest,char *src); int strcspn(char *src,char * set); int strlen (char *src); char *strncat (char 8dest,char *src,int len); char strncmp(char *string1,char *string2,int len); char strncpy (char *dest,char *src,int len); char *strpbrk (char *string,char *set); int strpos (const char *string,char c); char *strrchr (const char *string,char c); char *strrpbrk (char *string,char *set); int strrpos (const char *string,char c); int strspn(char *string,char *set);
例如8031、8051均为REG51.h其中包括了所有8051的SFR及其位定义,一般系统都必须包括本文件。
该文件中实际只定义了几个宏,以确定各存储空间的绝对地址。
其中包括拷贝比较移动等函数如:
流函数通8051的串口或用户定义的I/O口读写数据,缺省为8051串口,如要修改,比如改为LCD显示,可修改lib目录中的getkey.c及putchar.c源文件,然后在库中替换它们即可。
bit isalnum(char c);
unsigned char _crol_(unsigned char c,unsigned char b);
char getchar(void);
float atof(void * string);
void *memccpy (void *dest,void *src,char c,int len);
- Keil C51库函数(转)
- Keil C51库函数(转)
- [转]Keil C51库函数参考
- Keil C51库函数参考
- Keil C51库函数参考
- C51 库函数(转)
- keil C51部分库函数源代码
- Keil C51的本征库函数(intrinsic routines)
- Keil C51库函数原型列表
- KeilC51使用详解 :第五章 Keil C51库函数参考
- 万恶的keil(c51)
- Keil C51的代码效率(转帖)
- Keil C51高级编程(转帖)
- C51:Keil c51指针变量
- keil c51问答
- keil c51 可重如问题
- 学习心得之keil C51
- keil c51 拓展关键字
- 经典感悟,能改变你一生的五句话
- WebApplication开发利器--WebSnap
- 二维字符数组转换成二维整形数组
- MinGW介绍
- 用Delphi实现远程屏幕抓取[网摘]
- Keil C51库函数(转)
- 简易网络聊天室设计过程质量管理方案
- 用Delphi实现Ping类
- 第一次...
- zoundry 测试
- 如何编写SMTP邮件服务器
- RIA技术概览
- 转)C/C++语言void及void指针深层探索
- apache支持python写的CGI