2. 第二節(jié) 幾類重要庫函數(shù) 1. 1. 專用寄存器include文件 例如8031、8051均為REG51.h其中包括了所有8051的SFR及其位ㄒ,以掗伒统都眳Q氚ū疚募?br>2. 2. 絕對地址include文件absacc.h 該文件中實際只定義了幾個宏,以確定各存儲空間的絕對地址。 3. 3. 動態(tài)內(nèi)存分配函數(shù),位于stdlib.h中
4. 4. 緩沖區(qū)處理函數(shù)位于“string.h”中 其中包括拷貝比較移動等函數(shù)如: memccpy memchr memcmp memcpy memmove memset 這樣很方便地對緩沖區(qū)進行處理。 5. 5. 輸入輸出流函數(shù),位于“stdio.h”中 流函數(shù)通8051的串口或用戶定義的I/O口讀寫數(shù)據(jù),缺省為8051串口,如要修改,比如改為LCD顯示,可修改lib目錄中的getkey.c及putchar.c源文件,然后在庫中替換它們即可。 3. 第三節(jié) Keil C51庫函數(shù)原型列表 1. 1. CTYPE.H bit isalnum(char c); 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. 2. INTRINS.H unsigned char _crol_(unsigned char c,unsigned char b); 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. 3. STDIO.H char getchar(void); 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. 4. STDLIB.H float atof(void * string); 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. 5. STRING.H void *memccpy (void *dest,void *src,char c,int len); 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); |