📄 第一届飞思卡尔智能车竞赛华中科技大学的程序清单 1_大学生参考网.mht
字号:
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">/*=20
used in CarMain() */ <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'; =
mso-fareast-font-family: =CB=CE=CC=E5">#define=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #9f009f; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">STABMAX=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">50=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'; =
mso-fareast-font-family: =CB=CE=CC=E5">#define=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #9f009f; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">StopCar</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">()=20
PORTK |=3D 0x80 </SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">/*=20
stop the motor */ <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'; =
mso-fareast-font-family: =CB=CE=CC=E5">#define=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #9f009f; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">StartCar</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">()=20
PORTK |=3D 0x04 </SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">/*=20
start the motor */ <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'; =
mso-fareast-font-family: =CB=CE=CC=E5">#define=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #9f009f; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">BrakeCar</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">()=20
PORTK &=3D 0xfb </SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">/*=20
slow the speed of the SmartCar */ =
<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'; =
mso-fareast-font-family: =CB=CE=CC=E5">unsigned=20
int </SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">SYSCLOCK</SPAN><SPAN=20
lang=3DEN-US=20
style=3D"FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">=3D0;=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #009a00; FONT-FAMILY: 'Times New Roman'; =
mso-fareast-font-family: =CB=CE=CC=E5">/*=20
update in INT_Timer0() */ <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'; =
mso-fareast-font-family: =CB=CE=CC=E5"><FONT=20
size=3D3>/* <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'; =
mso-fareast-font-family: =CB=CE=CC=E5"><FONT=20
=
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'; =
mso-fareast-font-family: =CB=CE=CC=E5"><FONT=20
size=3D3>* FUNCTION PROTOTYPES <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'; =
mso-fareast-font-family: =CB=CE=CC=E5"><FONT=20
=
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>/* write in "SmartCar.c" */ =
<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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
initiate Real Time Interrupt */ =
<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"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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
INT_Timer0 initiate */ <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"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_PWMout</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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
initiate PWM output */ <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"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">void=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">PWMout</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'">int</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'">int</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
output PWM */ <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>/* write in "PID.c" */ =
<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_PID</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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
initiate PID parameter */ <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"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">int=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">CalculateP</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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
calculate parameter P */ <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"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">float=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">CalculatePID</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'">); =
</SPAN><SPAN=20
lang=3DEN-US style=3D"COLOR: #009a00; FONT-FAMILY: 'Times =
New Roman'">/*=20
calculate PID */ <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"COLOR: blue; FONT-FAMILY: 'Times New =
Roman'">int=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #870000; FONT-FAMILY: 'Times New =
Roman'">SignalProcess</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'">unsigned=20
</SPAN><SPAN lang=3DEN-US=20
style=3D"COLOR: #7f7f7f; FONT-FAMILY: 'Times New =
Roman'">char</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
Process the signal from the sensors */ =
<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>/* write in "Test.c" */ =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -