📄 第五章 keil c51库函数参考.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0056)http://www.51kaifa.com/zxyd/read_z.php?ID=482&BigClass=6 -->
<HTML XMLNS:O><HEAD><TITLE>第五章 Keil C51库函数参考- 无忧电子开发网-在线阅读</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="" name=Keywords><LINK href="第五章 Keil C51库函数参考.files/css.css"
type=text/css rel=stylesheet>
<SCRIPT language=JavaScript>function fontzoom(size){ document.getElementById('fontzoom').style.fontSize=size+'px'}</SCRIPT>
<!-- <script language="Javascript">document.oncontextmenu=new Function("event.returnValue=false");document.onselectstart=new Function("event.returnValue=false");</script> --><!-- 限制右键复制 -->
<META content="MSHTML 6.00.2900.2668" name=GENERATOR></HEAD>
<BODY topMargin=10 marginheight="10" marginwidth="10">
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
<TBODY>
<TR>
<TD width="100%">
<TABLE height=2 cellSpacing=0 cellPadding=0 width="100%" bgColor=#808080
border=0>
<TBODY>
<TR>
<TD width="100%"></TD></TR></TBODY></TABLE>
<TABLE height=80 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle width=186><A href="http://www.51kaifa.com/"><IMG
height=65 src="第五章 Keil C51库函数参考.files/logo.jpg" width=186
border=0></A></TD>
<TD align=middle width=574>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=bottom width=120><A
href="http://www.51kaifa.com/zxyd/"><IMG height=67
src="第五章 Keil C51库函数参考.files/logo_zxyd.gif" width=120
border=0></A></TD>
<TD width=454>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle width="100%" colSpan=3 height=19>
<TABLE cellSpacing=0 cellPadding=0 width="100%"
border=0>
<TBODY>
<TR>
<TD class=xyzx_top align=middle width="100%"
height=19><A
href="http://www.51kaifa.com/hyxw">综合资讯</A> <A
href="http://www.51kaifa.com/jswz">技术文章</A> <A
href="http://www.51kaifa.com/yyfa">原文阅读</A> <A
href="http://www.51kaifa.com/shop">在线商城</A> <A
href="http://www.51kaifa.com/zxxz">下载专区</A> <A
href="http://www.51kaifa.com/datasheet">DATASHEET</A>
<A href="http://www.51kaifa.com/bbs">技术论坛</A> <A
href="http://www.51kaifa.com/MenberInfo">商务频道</A>
</TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD width=47
background="第五章 Keil C51库函数参考.files/R_list_3.gif"><IMG
height=54 src="第五章 Keil C51库函数参考.files/R_list_2.gif"
width=48 border=0></TD>
<TD class=xyzx_top_shadow width=402
background="第五章 Keil C51库函数参考.files/R_list_3.gif">
<P style="LINE-HEIGHT: 150%"><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=2">电子技术</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=3">技术资料</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=11">嵌入式系统</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=6">单片机专题</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=10">DSP专题</A><BR><A
class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=8">EDA/PLD专题</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=12">电源技术专题</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=7">电子制作专题</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=4">其他综合</A><FONT
color=#ffffff> | </FONT><A class=xyzx_top2
href="http://www.51kaifa.com/zxyd/list.php?BigClass=13">芯片选型</A><BR></P></TD>
<TD width=5><IMG height=54 src="" width=5
border=0></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE height=4 cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width="100%"></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="98%" align=center border=0>
<TBODY>
<TR>
<TD align=middle width="5%" height=25><IMG
src="第五章 Keil C51库函数参考.files/R_url.jpg"></TD>
<TD width="95%">所在的位置:<A href="http://www.51kaifa.com/">首页</A></A> →
<A href="http://www.51kaifa.com/zxyd/">在线阅读</A></A> → <A
href="http://www.51kaifa.com/zxyd/list.php?BigClass=6">单片机专题</A> →
<A
href="http://www.51kaifa.com/zxyd/read.php?ID=81">KeilC51使用详解V1.0</A>
→ <FONT color=#ff9900>正文</FONT> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
<TBODY>
<TR>
<TD width="100%" bgColor=#808080 colSpan=3 height=1></TD></TR>
<TR>
<TD vAlign=top width=590>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=left width="100%"><!-- $sign哪个页面$digit位置$way等h不循环TR;X循环TR;$num显示个数 --></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="94%" align=center
border=0>
<TBODY>
<TR>
<TD align=middle width="100%"><FONT color=#05006c><B>第五章 Keil
C51库函数参考</B></FONT></TD></TR>
<TR>
<TD width="100%" height=6></TD></TR>
<TR>
<TD align=middle width="100%" height=18>
<TABLE style="BORDER-TOP: #666666 1px solid" height=2
cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD align=middle width="100%"
bgColor=#dce9fc></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD width="100%" height=6></TD></TR>
<TR>
<TD class=p16 id=fontzoom style="LINE-HEIGHT: 1.5" vAlign=top
width="100%" height=300><BR><!--画中画广告开始-->
<TABLE cellSpacing=0 cellPadding=0 align=left border=0>
<TBODY>
<TR>
<TD><!-- 广告位 --><!-- $sign哪个页面$digit位置$way等h不循环TR;X循环TR;$num显示个数 --></TD></TR></TBODY></TABLE><!--画中画广告结束-->
<P class=MsoNormal
style="TEXT-INDENT: 24pt; TEXT-ALIGN: left; tab-stops: 63.0pt 117.0pt"
align=left><SPAN lang=EN-US
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体">C51强大功能及其高效率的重要体现之一在于其丰富的可直接调用的库函数,多使用库函数使程序代码简单,结构清晰,易于调试和维护,下面介绍C51的库函数系统。</SPAN><SPAN
lang=EN-US
style="FONT-SIZE: 12pt; FONT-FAMILY: 宋体; mso-hansi-font-family: 'Times New Roman'"><O:P></O:P></SPAN></P>
<H2 style="MARGIN-LEFT: 0cm; TEXT-INDENT: 0cm"><A
name=_Toc475103199><SPAN lang=EN-US
style="FONT-SIZE: 16pt">第一节 </SPAN>本征库函数<SPAN
lang=EN-US>(intrinsic routines)和非本征证库函数</SPAN></A></H2>
<P class=MsoBodyTextFirstIndent><SPAN
lang=EN-US>C51提供的本征函数是指编译时直接将固定的代码插入当前行,而不是用ACALL和LCALL语句来实现,这样就大大提供了函数访问的效率,而非本征函数则必须由ACALL及LCALL调用。</SPAN></P>
<P class=MsoBodyTextFirstIndent><SPAN
lang=EN-US>C51的本征库函数只有9个,数目虽少,但都非常有用,列如下:</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_crol_,_cror_:将char型变量循环向左(右)移动指定位数后返回</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_iror_,_irol_:将int型变量循环向左(右)移动指定位数后返回</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_lrol_,_lror_:将long型变量循环向左(右)移动指定位数后返回</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_nop_:<SPAN
style="mso-tab-count: 1">
</SPAN>相当于插入NOP</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_testbit_:<SPAN style="mso-tab-count: 1">
</SPAN>相当于JBC bitvar测试该位变量并跳转同时清除。</SPAN></P>
<P class=MsoBodyTextIndent style="MARGIN-LEFT: 36.75pt"><SPAN
lang=EN-US>_chkfloat_:<SPAN style="mso-tab-count: 1">
</SPAN>测试并返回源点数状态。</SPAN></P>
<P class=MsoBodyTextFirstIndent>使用时,必须包含<SPAN
lang=EN-US>#inclucle<SPAN style="mso-spacerun: yes">
</SPAN><intrins.h>一行。</SPAN></P>
<P class=MsoBodyTextFirstIndent>如不说明,下面谈到的库函数均指非本征库函数。</P>
<H2 style="MARGIN-LEFT: 0cm; TEXT-INDENT: 0cm"><A
name=_Toc475103200><SPAN lang=EN-US
style="FONT-SIZE: 16pt">第二节 </SPAN>几类重要库函数</A></H2>
<H3 style="MARGIN-LEFT: 0cm; TEXT-INDENT: 0cm"><A
name=_Toc475103201><SPAN lang=EN-US style="FONT-SIZE: 15pt">1.
</SPAN>专用寄存器<SPAN lang=EN-US>include文件</SPAN></A></H3>
<P class=MsoBodyTextFirstIndent>例如<SPAN
lang=EN-US>8031、8051均为REG51.h其中包括了所有8051的SFR及其位定义,一般系统都必须包括本文件。</SPAN></P>
<H3 style="MARGIN-LEFT: 0cm; TEXT-INDENT: 0cm"><A
name=_Toc475103202><SPAN lang=EN-US style="FONT-SIZE: 15pt">2.
</SPAN>绝对地址<SPAN lang=EN-US>include文件absacc.h</SPAN></A></H3>
<P
class=MsoBodyTextFirstIndent>该文件中实际只定义了几个宏,以确定各存储空间的绝对地址。</P>
<H3 style="MARGIN-LEFT: 0cm; TEXT-INDENT: 0cm"><A
name=_Toc475103203><SPAN lang=EN-US style="FONT-SIZE: 15pt">3.
</SPAN>动态内存分配函数,位于<SPAN lang=EN-US>stdlib.h中</SPAN></A></H3>
<P class=MsoNormal
style="TEXT-INDENT: 24pt; TEXT-ALIGN: left; tab-stops: 63.0pt 117.0pt"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -