📄 main_8c.html
字号:
Definition at line <a class="el" href="main_8c-source.html#l00090">90</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00117">main()</a>.<div class="fragment"><pre class="fragment"><a name="l00091"></a>00091 {<a name="l00092"></a>00092 <span class="keywordflow">return</span> 8;<a name="l00093"></a>00093 }</pre></div><p></div></div><p><a class="anchor" name="7ce0a14b6e7779fbb2d9a05333792c41"></a><!-- doxytag: member="main.c::Init" ref="7ce0a14b6e7779fbb2d9a05333792c41" args="(void)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void Init </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Init of PID controller demo. <p><p>Definition at line <a class="el" href="main_8c-source.html#l00075">75</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="main_8c-source.html#l00037">K_D</a>, <a class="el" href="main_8c-source.html#l00035">K_I</a>, <a class="el" href="main_8c-source.html#l00033">K_P</a>, <a class="el" href="pid_8c-source.html#l00035">pid_Init()</a>, <a class="el" href="main_8c-source.html#l00048">pidData</a>, and <a class="el" href="pid_8h-source.html#l00025">SCALING_FACTOR</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00117">main()</a>.<div class="fragment"><pre class="fragment"><a name="l00076"></a>00076 {<a name="l00077"></a>00077 <a class="code" href="pid_8c.html#29fe06205528f56bcfdd242e3d1f9c19" title="Initialisation of PID controller parameters.">pid_Init</a>(<a class="code" href="main_8c.html#cfc98b8c69707c30ac9a96bb12f2a0ab">K_P</a> * <a class="code" href="pid_8h.html#1dfc2df4edf95f828461ec28a276d36c">SCALING_FACTOR</a>, <a class="code" href="main_8c.html#5e606c8dc6de900bea3cd7740ac1bd4d">K_I</a> * SCALING_FACTOR , <a class="code" href="main_8c.html#0b9e481775b5a7ecdd0dbb43cacc1a09">K_D</a> * SCALING_FACTOR , &<a class="code" href="main_8c.html#e95a1d87e515fada8578052871321ff9" title="Parameters for regulator.">pidData</a>);<a name="l00078"></a>00078 <a name="l00079"></a>00079 <span class="comment">// Set up timer, enable timer/counte 0 overflow interrupt</span><a name="l00080"></a>00080 TCCR0A = (1<<CS00);<a name="l00081"></a>00081 TIMSK0 = (1<<TOIE0);<a name="l00082"></a>00082 TCNT0 = 0;<a name="l00083"></a>00083 }</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_7ce0a14b6e7779fbb2d9a05333792c41_cgraph.png" border="0" usemap="#main_8c_7ce0a14b6e7779fbb2d9a05333792c41_cgraph_map" alt=""></center><map name="main_8c_7ce0a14b6e7779fbb2d9a05333792c41_cgraph_map"><area shape="rect" href="pid_8c.html#29fe06205528f56bcfdd242e3d1f9c19" title="Initialisation of PID controller parameters." alt="" coords="95,5,159,32"></map></div></div><p><a class="anchor" name="6288eba0f8e8ad3ab1544ad731eb7667"></a><!-- doxytag: member="main.c::main" ref="6288eba0f8e8ad3ab1544ad731eb7667" args="(void)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void main </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Demo of PID controller. <p><p>Definition at line <a class="el" href="main_8c-source.html#l00117">117</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="pid_8h-source.html#l00058">FALSE</a>, <a class="el" href="main_8c-source.html#l00099">Get_Measurement()</a>, <a class="el" href="main_8c-source.html#l00090">Get_Reference()</a>, <a class="el" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532">gFlags</a>, <a class="el" href="main_8c-source.html#l00075">Init()</a>, <a class="el" href="pid_8c-source.html#l00059">pid_Controller()</a>, <a class="el" href="main_8c-source.html#l00048">pidData</a>, <a class="el" href="main_8c-source.html#l00043">GLOBAL_FLAGS::pidTimer</a>, and <a class="el" href="main_8c-source.html#l00109">Set_Input()</a>.<div class="fragment"><pre class="fragment"><a name="l00118"></a>00118 {<a name="l00119"></a>00119 <a class="code" href="stdint_8h.html#269259c924dce846340ddbb810db2e3c">int16_t</a> referenceValue, measurementValue, inputValue;<a name="l00120"></a>00120 <a class="code" href="main_8c.html#7ce0a14b6e7779fbb2d9a05333792c41" title="Init of PID controller demo.">Init</a>();<a name="l00121"></a>00121 __enable_interrupt();<a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="keywordflow">while</span>(1){<a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="comment">// Run PID calculations once every PID timer timeout</span><a name="l00126"></a>00126 <span class="keywordflow">if</span>(<a class="code" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532" title="Flags for status information.">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#6a87af13be5ba5f4835749cc92528a09" title="True when PID control loop should run one time.">pidTimer</a>)<a name="l00127"></a>00127 {<a name="l00128"></a>00128 referenceValue = <a class="code" href="main_8c.html#5d425d60c4c5cc27b85f5d91f3089b24" title="Read reference value.">Get_Reference</a>();<a name="l00129"></a>00129 measurementValue = <a class="code" href="main_8c.html#6c21c2fcef2ac5b7bd483e1ca38f14e0" title="Read system process value.">Get_Measurement</a>();<a name="l00130"></a>00130 <a name="l00131"></a>00131 inputValue = <a class="code" href="pid_8c.html#c0129c983e062dd6ee925ea932bae93f" title="PID control algorithm.">pid_Controller</a>(referenceValue, measurementValue, &<a class="code" href="main_8c.html#e95a1d87e515fada8578052871321ff9" title="Parameters for regulator.">pidData</a>);<a name="l00132"></a>00132 <a name="l00133"></a>00133 <a class="code" href="main_8c.html#9890f9c197e2e87a8b187f2c4c821e7a" title="Set control input to system.">Set_Input</a>(inputValue);<a name="l00134"></a>00134 <a name="l00135"></a>00135 <a class="code" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532" title="Flags for status information.">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#6a87af13be5ba5f4835749cc92528a09" title="True when PID control loop should run one time.">pidTimer</a> = <a class="code" href="pid_8h.html#a93f0eb578d23995850d61f7d61c55c1">FALSE</a>;<a name="l00136"></a>00136 }<a name="l00137"></a>00137 }<a name="l00138"></a>00138 }</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_6288eba0f8e8ad3ab1544ad731eb7667_cgraph.png" border="0" usemap="#main_8c_6288eba0f8e8ad3ab1544ad731eb7667_cgraph_map" alt=""></center><map name="main_8c_6288eba0f8e8ad3ab1544ad731eb7667_cgraph_map"><area shape="rect" href="main_8c.html#6c21c2fcef2ac5b7bd483e1ca38f14e0" title="Read system process value." alt="" coords="104,5,237,32"><area shape="rect" href="main_8c.html#5d425d60c4c5cc27b85f5d91f3089b24" title="Read reference value." alt="" coords="115,56,227,83"><area shape="rect" href="main_8c.html#7ce0a14b6e7779fbb2d9a05333792c41" title="Init of PID controller demo." alt="" coords="151,107,191,133"><area shape="rect" href="pid_8c.html#c0129c983e062dd6ee925ea932bae93f" title="PID control algorithm." alt="" coords="119,157,223,184"><area shape="rect" href="main_8c.html#9890f9c197e2e87a8b187f2c4c821e7a" title="Set control input to system." alt="" coords="131,208,211,235"><area shape="rect" href="pid_8c.html#29fe06205528f56bcfdd242e3d1f9c19" title="Initialisation of PID controller parameters." alt="" coords="287,107,351,133"></map></div></div><p><a class="anchor" name="9890f9c197e2e87a8b187f2c4c821e7a"></a><!-- doxytag: member="main.c::Set_Input" ref="9890f9c197e2e87a8b187f2c4c821e7a" args="(int16_t inputValue)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">void Set_Input </td> <td>(</td> <td class="paramtype"><a class="el" href="stdint_8h.html#269259c924dce846340ddbb810db2e3c">int16_t</a> </td> <td class="paramname"> <em>inputValue</em> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Set control input to system. <p>Set the output from the controller as input to system. <p>Definition at line <a class="el" href="main_8c-source.html#l00109">109</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00117">main()</a>.<div class="fragment"><pre class="fragment"><a name="l00110"></a>00110 {<a name="l00111"></a>00111 ;<a name="l00112"></a>00112 }</pre></div><p></div></div><p><a class="anchor" name="8b6ed5249679f9ab632635809380a5e5"></a><!-- doxytag: member="main.c::TIMER0_OVF_ISR" ref="8b6ed5249679f9ab632635809380a5e5" args="(void)" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">__interrupt void TIMER0_OVF_ISR </td> <td>(</td> <td class="paramtype">void </td> <td class="paramname"> </td> <td> ) </td> <td width="100%"></td> </tr> </table></div><div class="memdoc"><p>Timer interrupt to control the sampling interval. <p><p>Definition at line <a class="el" href="main_8c-source.html#l00062">62</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532">gFlags</a>, <a class="el" href="main_8c-source.html#l00043">GLOBAL_FLAGS::pidTimer</a>, <a class="el" href="main_8c-source.html#l00057">TIME_INTERVAL</a>, and <a class="el" href="pid_8h-source.html#l00059">TRUE</a>.<div class="fragment"><pre class="fragment"><a name="l00063"></a>00063 {<a name="l00064"></a>00064 <span class="keyword">static</span> <a class="code" href="stdint_8h.html#273cf69d639a59973b6019625df33e30">uint16_t</a> i = 0;<a name="l00065"></a>00065 <span class="keywordflow">if</span>(i < <a class="code" href="main_8c.html#847b99b287f7c6555ab0f1cb4ed52119">TIME_INTERVAL</a>)<a name="l00066"></a>00066 i++;<a name="l00067"></a>00067 <span class="keywordflow">else</span>{<a name="l00068"></a>00068 <a class="code" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532" title="Flags for status information.">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#6a87af13be5ba5f4835749cc92528a09" title="True when PID control loop should run one time.">pidTimer</a> = <a class="code" href="pid_8h.html#a8cecfc5c5c054d2875c03e77b7be15d">TRUE</a>;<a name="l00069"></a>00069 i = 0;<a name="l00070"></a>00070 }<a name="l00071"></a>00071 }</pre></div><p></div></div><p><hr><h2>Variable Documentation</h2><a class="anchor" name="37da6ea23a280bce8cc2ba16f6a31532"></a><!-- doxytag: member="main.c::gFlags" ref="37da6ea23a280bce8cc2ba16f6a31532" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structGLOBAL__FLAGS.html">GLOBAL_FLAGS</a> <a class="el" href="main_8c.html#37da6ea23a280bce8cc2ba16f6a31532">gFlags</a> </td> </tr> </table></div><div class="memdoc"><p>Flags for status information. <p><p>Referenced by <a class="el" href="main_8c-source.html#l00117">main()</a>, and <a class="el" href="main_8c-source.html#l00062">TIMER0_OVF_ISR()</a>.</div></div><p><a class="anchor" name="e95a1d87e515fada8578052871321ff9"></a><!-- doxytag: member="main.c::pidData" ref="e95a1d87e515fada8578052871321ff9" args="" --><div class="memitem"><div class="memproto"> <table class="memname"> <tr> <td class="memname">struct <a class="el" href="structPID__DATA.html">PID_DATA</a> <a class="el" href="main_8c.html#e95a1d87e515fada8578052871321ff9">pidData</a> </td> </tr> </table></div><div class="memdoc"><p>Parameters for regulator. <p><p>Definition at line <a class="el" href="main_8c-source.html#l00048">48</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00075">Init()</a>, and <a class="el" href="main_8c-source.html#l00117">main()</a>.</div></div><p><hr size="1"><address style="text-align: right;"><small>Generated on Mon Sep 17 09:08:12 2007 for AVR221 - PID controller by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -