?? mega8學習筆記(9)-------cocoguojia 原創(chuàng)--單片機實驗室-----嘉哥.htm
字號:
lang=EN-US><FONT
face="Times New Roman">SS</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">腳要處理好,一般來說設為輸出,在連接從機的</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SS</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 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo1; tab-stops: list 18.0pt"><SPAN
lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'"><SPAN
style="mso-list: Ignore"><FONT
face="Times New Roman">2、<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">把要發(fā)送數(shù)據(jù)寫進</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SPDR</FONT></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo1; tab-stops: list 18.0pt"><SPAN
lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'"><SPAN
style="mso-list: Ignore"><FONT
face="Times New Roman">3、<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">若</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">spi</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中斷開啟并</SPAN><SPAN
lang=EN-US><FONT face="Times New Roman">
asm</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(“</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">sei</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”)了,則發(fā)送完畢后將觸發(fā)</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">spi</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><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">我們再從</SPAN><FONT
face="Times New Roman"> </FONT><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">從機</SPAN><FONT
face="Times New Roman"> </FONT><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">發(fā)送看起:</SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT
face="Times New Roman">1</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SS</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 18pt; TEXT-INDENT: -18pt; mso-list: l1 level1 lfo1; tab-stops: list 18.0pt"><FONT
face="Times New Roman"><SPAN lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'"><SPAN
style="mso-list: Ignore">4、<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></SPAN></SPAN><SPAN
lang=EN-US>2</SPAN></FONT><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、把要發(fā)送數(shù)據(jù)寫進</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SPDR</FONT></SPAN></P>
<P class=MsoNormal
style="MARGIN: 0cm 0cm 0pt 18pt; TEXT-INDENT: -18pt; mso-list: l0 level1 lfo2; tab-stops: list 18.0pt"><SPAN
lang=EN-US
style="mso-fareast-font-family: 'Times New Roman'"><SPAN
style="mso-list: Ignore"><FONT
face="Times New Roman">3、<SPAN
style="FONT: 7pt 'Times New Roman'">
</SPAN></FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">只有在</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SS</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被拉低后,從機才能動作,將</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SS</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">4</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">、若</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">spi</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中斷開啟并</SPAN><SPAN
lang=EN-US><FONT face="Times New Roman">
asm</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">(“</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">sei</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">”)了,則發(fā)送完畢后將觸發(fā)</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">spi</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><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">至于接受,哈哈,接受簡單啊,在發(fā)送結(jié)束后,直接讀</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SPDR</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><o:p><FONT
face="Times New Roman"> </FONT></o:p></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面就編寫個程序試試吧</SPAN><FONT
face="Times New Roman"> </FONT></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">//</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">用</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">SPI</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">方式實現(xiàn)單數(shù)碼管的</SPAN><SPAN
lang=EN-US><FONT face="Times New Roman">
10</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">秒計數(shù)顯示</SPAN><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'">數(shù)碼管是共陽的,</P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">段選用</SPAN><SPAN
lang=EN-US><FONT
face="Times New Roman">74hc164</FONT></SPAN></P></SPAN>
<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">#i nclude
<mega8.h><SPAN
style="mso-spacerun: yes">
</SPAN>//</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">#i nclude
<delay.h><SPAN
style="mso-spacerun: yes">
</SPAN>//</FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引用系統(tǒng)自帶的延時函數(shù)</SPAN><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></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><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></FONT></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">段選</SPAN><SPAN
lang=EN-US><SPAN style="mso-spacerun: yes"><FONT
face="Times New Roman"> </FONT></SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">供查表用</SPAN><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">//<SPAN
style="mso-spacerun: yes">
</SPAN>0<SPAN
style="mso-spacerun: yes">
</SPAN>1<SPAN
style="mso-spacerun: yes">
</SPAN>2<SPAN
style="mso-spacerun: yes">
</SPAN>3<SPAN
style="mso-spacerun: yes">
</SPAN>4<SPAN
style="mso-spacerun: yes">
</SPAN>5<SPAN
style="mso-spacerun: yes">
</SPAN>6<SPAN
style="mso-spacerun: yes">
</SPAN>7<SPAN
style="mso-spacerun: yes">
</SPAN>8<SPAN
style="mso-spacerun: yes">
</SPAN>9<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">unsigned char
constsm_duan[10]={~0X<st1:chmetcnv w:st="on" TCSC="0"
NumberType="1" Negative="False" HasSpace="False"
SourceValue="3"
UnitName="F">3F</st1:chmetcnv>,~0X06,~0X5B,~0X<st1:chmetcnv
w:st="on" TCSC="0" NumberType="1" Negative="False"
HasSpace="False" SourceValue="4"
UnitName="F">4F</st1:chmetcnv>,~0X66,~0X6D,~0X7D,~0X07,~0X<st1:chmetcnv
w:st="on" TCSC="0" NumberType="1" Negative="False"
HasSpace="False" SourceValue="7"
UnitName="F">7F</st1:chmetcnv>,0X90};
//此行是由于博客格式的影響,其實這是上面一行的</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">
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -