📄 在51系列单片机上移植ucos-ii .htm
字号:
<P>WordTable->Num=0;<BR>WordTable->LeftCurveNum=0;<BR>WordTable->RightCurveNum=0;</P>
<P>ch=ComBuf[0];<BR>while(!SentenceEndFlag&&i if((ch>="0"&&ch<="9")||(ch>="a"&&ch<="z")||(ch>="A"&&ch<="Z")||(ch==".")){<BR>if(StrFlag==0){<BR>StrFlag=1;k=k+1;j=0;<BR>if(k>=MaxLenWordTable) return 0;<BR>WordTable->wt[k].Str[j]=ch;<BR>WordTable->Num=k+1;<BR>}<BR>else{<BR>j=j+1;<BR>if(j>=MaxLenWord) return 0;<BR>WordTable->wt[k].Str[j]=ch;<BR>}<BR>}<BR>else if(ch==" "||ch==","||ch=="("||ch==")"||ch=="\0"){<BR>if(ch=="(") WordTable->LeftCurveNum++;<BR>if(ch==")") WordTable->RightCurveNum++;<BR>if(StrFlag==1){<BR>StrFlag=0;j=j+1;<BR>WordTable->wt[k].Str[j]="\0";<BR>WordTable->wt[k].Length=j;<BR>}<BR>if(ch=="\0") SentenceEndFlag=1;<BR>}<BR>else{<BR>return 0;<BR>}<BR>i=i+1;<BR>ch=ComBuf[i];<BR>}<BR>if(i if(WordTable->LeftCurveNum==WordTable->RightCurveNum) return 1;<BR>else return 0;<BR>}<BR>else{<BR>return 0;<BR>}<BR>}</P>
<P>输入回显和命令解释执行<BR>void yyshell(void *yydata) reentrant<BR>{<BR>yydata=yydata;<BR>clrscr();<BR>PrintStr("\t\t***********************************************\n");<BR>PrintStr("\t\t* Welcom to use this program *\n");<BR>PrintStr("\t\t* Author:YangYi 20020715 *\n");<BR>PrintStr("\t\t***********************************************\n\n\n");</P>
<P>/*Login & Password*/</P>
<P>PrintStr("% ");<BR>while(!ShellEnd){</P>
<P>switch(State){<BR>case StatInputCom:{<BR>if(yygetch(&ch)){<BR>if(ch==13) /*Enter return key*/<BR>{<BR>PrintStr("\n");<BR>ComBuf[i+1]="\0"; <BR>if(i+1==0) PrintStr("% ");<BR>else <BR>State=StatExeCom;<BR>}<BR>else{<BR>i=i+1;<BR>if((i>=MaxLenComBuf)&&(ch!=8)){<BR>PrintChar(7);<BR>i=MaxLenComBuf-1;<BR>}<BR>else{<BR>if(ch==8){<BR>i=i-2;<BR>if(i<-1) {i=-1;PrintChar(7);}<BR>else{<BR>PrintChar(8);<BR>PrintChar(" ");<BR>PrintChar(8);<BR>}<BR>}<BR>else{<BR>PrintChar(ch);<BR>ComBuf[i]=ch;<BR>}<BR>}<BR>}<BR>break;<BR>}<BR>else{<BR>//OSTimeDly(10);<BR>break;<BR>}<BR>}<BR>case StatExeCom:{<BR>if(GetWord(ComBuf,&WordTable)==1&&WordTable.Num!=0){<BR>yystrlwr(WordTable.wt[0].Str);<BR>for(tem=0;tem if(yystrcmp(WordTable.wt[0].Str,ComTable[tem])==0) ComMatchFlag=1;<BR>if(ComMatchFlag){<BR>tem--;<BR>switch(tem){<BR>case 0:{DisplayTask(&WordTable);break;}<BR>case 1:{Kill(&WordTable);break;}<BR>case 2:{PingCommand(&WordTable);break;}<BR>case 3:{UDPCommand(&WordTable);break;}<BR>case 4:{CfgHost(&WordTable);break;}<BR>case 5:{CfgMask(&WordTable);break;}<BR>case 6:{CfgGateway(&WordTable);break;} <BR>case 7:{<BR>//ShellEnd=1;<BR>PrintStr("\n\tThis Command is limited!\n\n");<BR>break;<BR>}<BR>case 8:{PrintConfig(&WordTable);break;}<BR>case 9:{clrscr();break;}<BR>case 10:{DisplayHelpMenu(&WordTable);break;}<BR>} <BR>}<BR>else<BR>PrintStr(" Bad command!\n\n");<BR>}<BR>else{<BR>if(WordTable.Num) PrintStr(" Bad command!\n\n");<BR>}</P>
<P>ComMatchFlag=0;<BR>State=StatInputCom;<BR>if(ShellEnd) {PrintStr("\n\n");}<BR>else PrintStr("% ");<BR>i=-1;<BR>break;<BR>}<BR>default:{<BR>//ShellEnd=1;<BR>PrintStr("System fatal error!\n");<BR>PrintChar(7);PrintChar(7);PrintChar(7);<BR>}<BR>}<BR>}<BR>}</P>
<P>以上是我这次移植uCOS51的一些心得,写出来只是让准备在51上运行操作系统的同行们少走弯路并增强使用信心。我强烈推荐大家在自己的51系统中使用uCOS这个简单实用的自己的操作系统。它的大小应该不是问题,性能上的提高却是显著的。但愿此文能对朋友们有所帮助,错误在所难免,希望读者指正。</P>
<P>参考文献:<BR>1.邵贝贝译. μC/OS-II 源码公开的实时嵌入式操作系统 中国电力出版社</P>
<P><BR></P></TD></TR>
<TR vAlign=top>
<TD style="LINE-HEIGHT: 140%; LETTER-SPACING: 1px"
width=*></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE><BR>--------------------------------------------------------------------------------------------<BR>本站转载部分文档<BR>如有原创者对这些文档有疑问,请与站长联系(E.mail:webmaster@docsky.com
)!<BR>--------------------------------------------------------------------------------------------<BR>
<TABLE width="100%">
<TBODY>
<TR>
<TD class=jnfont6 width="45%"><IMG height=17
src="在51系列单片机上移植uCOS-II .files/back.gif" width=17
align=absMiddle> <A
href="http://www.docsky.com/doclist.asp?category=嵌入开发&category1=实时操作系统&category2=UCOS/UCOSII">返回列表</A>||<A
href="http://www.docsky.com/post.asp?category=嵌入开发&category1=实时操作系统&category2=UCOS/UCOSII">发表新文档</A>||<A
href="http://www.docsky.com/favorite.asp?title_id=1634&title_category=doc">关注该文档</A>
</TD>
<TD class=jnfont6 align=right width="55%">[ 发表时间:2004-2-25
18:42:14 ] <A
href="http://www.docsky.com/show.asp?id=1634#"><IMG height=15
alt=返上 src="在51系列单片机上移植uCOS-II .files/gotop.gif" width=15
border=0></A> </TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></FORM>
<TABLE class=table004 cellSpacing=0 cellPadding=3 width=600 align=center
border=0>
<TBODY>
<TR>
<TD class=table003 align=middle
background=在51系列单片机上移植uCOS-II .files/title.gif>:在 此 直 接 回 复 当 前 文
档:</TD></TR></TBODY></TABLE>
<TABLE class=table004 cellSpacing=0 cellPadding=2 width=600 align=center
border=0>
<FORM name=Dvform onsubmit="return submitOnce()" action=rpost_do.asp
method=post>
<TBODY>
<TR>
<TD class=table001 align=right width=90>发 言 标 题:</TD>
<TD class=table001 width=*><INPUT class=input1 maxLength=40 size=40
value=Re:在51系列单片机上移植uCOS-II name=title> <FONT
color=#ff0000>*</FONT>(标题限制 <B>40</B> 个字符以内)</TD></TR>
<TR>
<TD class=table001 align=right width=90>发 表 人:</TD>
<TD class=table001 width=*><INPUT class=input1 maxLength=20 value=游客
name=name> <FONT color=#ff0000>*</FONT>(名字限制 <B>10</B> 个字符以内)</TD></TR>
<TR>
<TD class=table001 align=right width=90>密 码(可选): </TD>
<TD class=table001 width=*><INPUT class=input1 type=password
maxLength=10 size=15 name=pass> (填写密码成为保留用户,名字将被保护) </TD></TR>
<TR>
<TD class=table001 align=right width=90>选 择 表 情:</TD>
<TD class=table001 width=*>
<TABLE cellSpacing=1 cellPadding=0 width="85%" border=0>
<TBODY>
<TR>
<TD align=middle><INPUT type=radio CHECKED value=p1.gif
name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p1.gif" border=0></TD>
<TD align=middle><INPUT type=radio value=p2.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p2.gif" border=0></TD>
<TD align=middle><INPUT type=radio value=p3.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p3.gif" border=0></TD>
<TD align=middle><INPUT type=radio value=p4.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p4.gif" border=0></TD>
<TD><INPUT type=radio value=p5.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p5.gif" border=0></TD>
<TD><INPUT type=radio value=p6.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p6.gif" border=0></TD>
<TD><INPUT type=radio value=p7.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p7.gif" border=0></TD>
<TD><INPUT type=radio value=p8.gif name=pic> </TD>
<TD><IMG src="在51系列单片机上移植uCOS-II .files/p8.gif" border=0></TD>
<TD><INPUT type=radio value=p9.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p9.gif"
width=15 border=0></TD></TR>
<TR>
<TD align=middle><INPUT type=radio value=p10.gif name=pic> </TD>
<TD><IMG height=22 src="在51系列单片机上移植uCOS-II .files/p10.gif"
width=15 border=0></TD>
<TD align=middle><INPUT type=radio value=p11.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p11.gif"
width=15 border=0></TD>
<TD align=middle><INPUT type=radio value=p12.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p12.gif"
width=15 border=0></TD>
<TD align=middle><INPUT type=radio value=p13.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p13.gif"
width=15 border=0></TD>
<TD><INPUT type=radio value=p14.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p14.gif"
width=15 border=0></TD>
<TD><INPUT type=radio value=p15.gif name=pic> </TD>
<TD><IMG height=15 src="在51系列单片机上移植uCOS-II .files/p15.gif"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -