?? 第一屆飛思卡爾智能車競賽華中科技大學的程序清單 2_大學生參考網.mht
字號:
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">if</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Direction</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'"><3000)=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Direction</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">=3D3000;=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">if</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Direction</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">>6000)=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Direction</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">=3D6000;=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">PWMPER01 =3D 60000;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
Center=20
1500ms*3 */ <o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">PWMDTY01 =3D=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Direction</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">+93; =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
</SPAN><SPAN=20
style=3D"COLOR: #009a00; mso-bidi-font-family: 'Times New =
Roman'; mso-ascii-font-family: 'Times New Roman'"><FONT=20
=
face=3D=BA=DA=CC=E5>=C9=E8=D6=C3=B6=E6=BB=FA=BD=C7=B6=C8</FONT></SPAN><SP=
AN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'"> */ =
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">if</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Velocity</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">>24000)=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Velocity</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">=3D24000;=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">PWMPER45 =3D 24000;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
1kHz (=20
<10kHz ) */ <o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">PWMDTY45 =3D=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">Velocity</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">; =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
</SPAN><SPAN=20
style=3D"COLOR: #009a00; mso-bidi-font-family: 'Times New =
Roman'; mso-ascii-font-family: 'Times New Roman'"><FONT=20
=
face=3D=BA=DA=CC=E5>=C9=E8=D6=C3=B5=E7=BB=FA=CB=D9=B6=C8</FONT></SPAN><SP=
AN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'"> */ =
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>}=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* initiate Real Time Interrupt 1.0 */=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">Init_INT_RTI</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">)=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>{=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT =
size=3D3>RTICTL =3D 0x74;=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT =
size=3D3>CRGINT |=3D0x80;=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>}=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* Real Time Interrupt 1.0 */ =
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">interrupt=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New Roman'">void=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">INT_RTI</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">)=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>{=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">CRGFLG =
|=3D 0x80;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
clear the=20
interrrupt flag */ <o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>}=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* INT_Timer0 initiate 1.0 */ =
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">Init_INT_Timer</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">(</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void</SPAN><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">)=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>{=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">TSCR2 =
=3D0x07;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
128Hz at=20
<st1:chmetcnv TCSC=3D"0" NumberType=3D"1" Negative=3D"False" =
HasSpace=3D"False" SourceValue=3D"16" UnitName=3D"m"=20
w:st=3D"on">16M</st1:chmetcnv> bus clok */=20
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* 128Hz * 2/3 at <st1:chmetcnv TCSC=3D"0" =
NumberType=3D"1"=20
Negative=3D"False" HasSpace=3D"False" SourceValue=3D"24" =
UnitName=3D"m"=20
w:st=3D"on">24m</st1:chmetcnv> bus clock */=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* in fact it is a little more than it. */=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">TIOS =
|=3D0x01;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
I/O select=20
*/ <o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New Roman'">TIE =
|=3D0x01;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/* =
Interrupt=20
Enable */ <o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><FONT =
size=3D3><SPAN=20
lang=3DEN-US style=3D"FONT-FAMILY: 'Times New =
Roman'">TSCR1|=3D0x80;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'">/*=20
TSCR1_TEN=3D1 //Timer Enable */ =
<o:p></o:p></SPAN></FONT></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'"><FONT size=3D3>}=20
<o:p></o:p></FONT></SPAN></P>
<P class=3DDefault style=3D"MARGIN: 0cm 0cm 0pt"><SPAN =
lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New =
Roman'"><FONT=20
size=3D3>/* INT_Timer0 1.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -