📄 ucos电子技术,网友心得文章浏览.htm
字号:
*WordTable)<BR>{<BR>int i=0; /*ComBuf String pointer*/<BR>int
j=0; /*Length of Word */<BR>int k=-1; /*The number of
WordTable*/<BR>int StrFlag=0; /*There is "0-9/a-z/A-Z" before
" ,()"*/<BR>int SentenceEndFlag=0; /*Sentence end*/<BR>char
ch;</P>
<P>WordTable->Num=0;<BR>WordTable->LeftCurveNum=0;<BR>WordTable->RightCurveNum=0;</P>
<P>ch=ComBuf[0];<BR>while(!SentenceEndFlag&&i<MAXLENCOMBUF){<BR>
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<MAXLENCOMBUF||COMBUF[MAXLENCOMBUF]=='\0'){<BR>
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");<BR><BR>/*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<MAXCOMNUM&&!COMMATCHFLAG;TEM++)<BR>
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></P></TD></TR>
<TR>
<TD vAlign=top colSpan=2
height=18><!--DWLayoutEmptyCell--> </TD></TR>
<TR>
<TD vAlign=center width=417 height=24> 资源点评<FONT
color=#ff0000> 0篇</FONT></TD>
<TD vAlign=center width=133><A
onclick=javascript:showComment()
href="http://www.eleku.com/comment/comment.asp?type=art&id=131"
target=main><B>我要评论</B></A></TD></TR></TBODY></TABLE>
<DIV id=mainWindow style="DISPLAY: none" align=center><IFRAME
name=main align=middle src="UCOS电子技术,网友心得文章浏览.files/read.htm"
frameBorder=0 width=570
height=400></IFRAME></DIV></TD></TR></TBODY></TABLE></TD></TR>
<TR>
<TD vAlign=top background=UCOS电子技术,网友心得文章浏览.files/c-dbg.gif colSpan=3
height=19><IMG height=19 src="UCOS电子技术,网友心得文章浏览.files/c-dl.gif"
width=780></TD></TR></TBODY></TABLE>
<STYLE>.bottom_link1:link {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link1:visited {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link1:active {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link1:hover {
RIGHT: 0px; COLOR: #000000; POSITION: relative; TOP: 1px; TEXT-DECORATION: none
}
.bottom_link2:link {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link2:visited {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link2:active {
COLOR: #000000; TEXT-DECORATION: none
}
.bottom_link2:hover {
COLOR: #003399; TEXT-DECORATION: underline
}
</STYLE>
<TABLE style="FONT-SIZE: 9pt" cellSpacing=0 cellPadding=0 width=780 align=center
border=0><!--DWLayoutTable-->
<TBODY>
<TR>
<TD vAlign=top colSpan=2 height=25><IMG height=25
src="UCOS电子技术,网友心得文章浏览.files/bottom_r1_c1.jpg" width=780></TD></TR>
<TR>
<TD style="LINE-HEIGHT: 18px" vAlign=center align=middle width=457
background=UCOS电子技术,网友心得文章浏览.files/bottom_r2_c1.jpg height=55><A
class=bottom_link1 href="http://www.eleku.com/index.asp">电子酷世界</A>(C)
2003-2005 版权所有 <A class=bottom_link1
href="http://www.eleku.com/index.asp">http://www.eleku.com/index.asp</A>
All Rights Reserved<BR>电子信箱 <A class=bottom_link1
href="mailto:zydz70398@yahoo.com.cn">zydz70398@yahoo.com.cn</A>
24小时服务电话:13584822600 qq:44332854<BR>维护制作:<A class=bottom_link1
href="mailto:flamephenix@163.com">冰点火焰</A> Powerd By Iceflame Studio
Design By Flamephenix </TD>
<TD vAlign=top width=323><IMG height=55
src="UCOS电子技术,网友心得文章浏览.files/bottom_r2_c2.jpg"
width=323></TD></TR></TBODY></TABLE>
<SCRIPT src="UCOS电子技术,网友心得文章浏览.files/mystat.htm"></SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -