?? mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.htm
字號:
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">//</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">初始化</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman">void
init(void)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">{</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>SFIOR=0X08;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>DDRB=0XFF;<SPAN style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>SPCR=0X50;<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman">}<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">//-------------------------------------------------<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">//-------------------------------------------------<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">//</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">主函數</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman">void
main(void)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman">{<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>unsigned char i;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>init();<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>while(1)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>{ </FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN><SPAN
style="mso-spacerun: yes"> </SPAN>for(i=0;i<=9;i++)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>{</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>SPDR=sm_duan[i];<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>while(! (SPSR & (1<<7))
)</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>{</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>;</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>}<SPAN style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>delay_ms(1000);</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>}</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT face="Times New Roman"><SPAN
style="mso-spacerun: yes">
</SPAN>}<SPAN style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><SPAN style="mso-spacerun: yes"><FONT
face="Times New Roman">
</FONT></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">}</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">//---------------------END----------------------------<SPAN
style="mso-spacerun: yes">
</SPAN></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P></SPAN></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD height=3> </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY class=seyle99>
<TR>
<TD>
<DIV align=right><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/archives/2008/28306.html#">閱讀全文<SPAN
id=ob_logreaded></SPAN></A> | <A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/archives/2008/28306.html#cmt">回復(0)</A>
<SPAN id=ob_logm28306></SPAN>| <A
href="http://www.mcublog.com/blog/showtb.asp?id=28306"
target=_blank>引用通告<SPAN id=ob_tbnum></SPAN></A> | <A
href="http://www.mcublog.com/blog/user_post.asp?logid=28306"
target=_blank>編輯</A></DIV></TD></TR></TBODY></TABLE>
<TABLE height=14 cellSpacing=0 cellPadding=0 width="100%"
align=center border=0>
<TBODY>
<TR>
<TD
class=content5></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<DIV id=blogaddon>
<LI>標簽:<SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=485">mega8</A></SPAN> <SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=33">avr</A></SPAN> <SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=5559">cvavr</A></SPAN> <SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=1614">SPI</A></SPAN> <SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=5639">74LS164</A></SPAN> <SPAN><A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/cmd.html?uid=16550&do=tag_blogs&id=5591">自學</A></SPAN> </LI></DIV>
<DIV id=morelog>
<UL>
<LI>上一篇:<A
href="http://www.mcublog.com/blog/blog2007/cocoguojia/archives/2008/28291.html">eeprom讀寫實驗</A>
</LI></UL></DIV>
<DIV id=form_comment>
<DIV id=gg_usercomment></DIV><A name=cmt></A>
<DIV class=title>發表評論:</DIV>
<FORM id=commentform name=commentform
onsubmit="return Verifycomment()"
action=/blog/savecomment.asp?logid=28306 method=post>
<DIV class=d1><LABEL>昵稱:<INPUT id=UserName maxLength=20
name=UserName></LABEL></DIV>
<DIV class=d2><LABEL>密碼:<INPUT id=Password type=password
maxLength=20 name=Password> (游客無須輸入密碼)</LABEL></DIV>
<DIV class=d3><LABEL>主頁:<INPUT id=homepage maxLength=50 size=42
value=http:// name=homepage></LABEL></DIV>
<DIV class=d4><LABEL>標題:<INPUT id=commenttopic maxLength=50 size=42
value=Re:Mega8學習筆記(9)-------cocoguojia 原創
name=commenttopic></LABEL></DIV>
<DIV class=d5><INPUT id=edit type=hidden name=edit>
<DIV id=oblog_edit>數據載入中...</DIV></DIV>
<DIV class=d6><SPAN id=ob_code></SPAN><INPUT onclick='oblog_edittext.createTextRange().execCommand("Copy");' type=submit value= 提 交 ></DIV></FORM></DIV></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top align=right width=205><IMG height=425 alt=""
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/index_04.jpg"
width=150></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=1004 border=0>
<TBODY>
<TR>
<TD vAlign=top bgColor=#f4f4f4><IMG height=18 alt=""
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/index_16.jpg"
width=1004> </TD></TR></TBODY></TABLE><SPAN id=gg_userbot></SPAN>
<DIV id=powered><A href="http://www.mcublog.com/" target=_blank><IMG
alt="Powered by McuBLog."
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/mcublog_powered.gif"
border=0></A></DIV>
<SCRIPT
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/200806.htm"></SCRIPT>
<SCRIPT
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/count.htm"></SCRIPT>
<SCRIPT
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/commentedit.htm"></SCRIPT>
<SCRIPT
src="F:\download\mega8學習筆記\Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files\count(1).htm"></SCRIPT>
<SCRIPT src=""></SCRIPT>
<SCRIPT
src="Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files/ShowXml.htm"></SCRIPT>
<SCRIPT
src="F:\download\mega8學習筆記\Mega8學習筆記(9)-------cocoguojia 原創--單片機實驗室-----嘉哥.files\count(2).htm"></SCRIPT>
</BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -