📄 main_8c.html
字号:
00092 <span class="keywordflow">return</span> 8;00093 }</div></pre> </td> </tr></table><a class="anchor" name="a7" doxytag="main.c::Init" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Init </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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>.<p><pre class="fragment"><div>00076 {00077 <a class="code" href="pid_8h.html#a7">pid_Init</a>(K_P * SCALING_FACTOR, K_I * SCALING_FACTOR , K_D * SCALING_FACTOR , &pidData);00078 00079 <span class="comment">// Set up timer, enable timer/counte 0 overflow interrupt</span>00080 TCCR0A = (1<<CS00);00081 TIMSK0 = (1<<TOIE0);00082 TCNT0 = 0;00083 }</div></pre><p>Here is the call graph for this function:<p><center><img src="main_8c_a7_cgraph.png" border="0" usemap="#main_8c_a7_cgraph_map" alt=""></center><map name="main_8c_a7_cgraph_map"><area href="pid_8h.html#a7" shape="rect" coords="96,7,160,33" alt=""></map> </td> </tr></table><a class="anchor" name="a11" doxytag="main.c::main" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void main </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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#a4">gFlags</a>, <a class="el" href="main_8c-source.html#l00075">Init()</a>, <a class="el" href="stdint_8h-source.html#l00028">int16_t</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>.<p><pre class="fragment"><div>00118 {00119 <a class="code" href="stdint_8h.html#a57">int16_t</a> referenceValue, measurementValue, inputValue;00120 <a class="code" href="main_8c.html#a7">Init</a>();00121 __enable_interrupt();00122 00123 <span class="keywordflow">while</span>(1){00124 00125 <span class="comment">// Run PID calculations once every PID timer timeout</span>00126 <span class="keywordflow">if</span>(<a class="code" href="main_8c.html#a4">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#o1">pidTimer</a>)00127 {00128 referenceValue = <a class="code" href="main_8c.html#a8">Get_Reference</a>();00129 measurementValue = <a class="code" href="main_8c.html#a9">Get_Measurement</a>();00130 00131 inputValue = <a class="code" href="pid_8h.html#a8">pid_Controller</a>(referenceValue, measurementValue, &pidData);00132 00133 <a class="code" href="main_8c.html#a10">Set_Input</a>(inputValue);00134 00135 <a class="code" href="main_8c.html#a4">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#o1">pidTimer</a> = <a class="code" href="pid_8h.html#a4">FALSE</a>;00136 }00137 }00138 }</div></pre><p>Here is the call graph for this function:<p><center><img src="main_8c_a11_cgraph.png" border="0" usemap="#main_8c_a11_cgraph_map" alt=""></center><map name="main_8c_a11_cgraph_map"><area href="main_8c.html#a9" shape="rect" coords="108,7,242,34" alt=""><area href="main_8c.html#a8" shape="rect" coords="119,58,231,84" alt=""><area href="main_8c.html#a7" shape="rect" coords="155,108,195,135" alt=""><area href="pid_8h.html#a8" shape="rect" coords="123,159,227,186" alt=""><area href="main_8c.html#a10" shape="rect" coords="135,210,215,236" alt=""><area href="pid_8h.html#a7" shape="rect" coords="291,108,355,135" alt=""></map> </td> </tr></table><a class="anchor" name="a10" doxytag="main.c::Set_Input" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> void Set_Input </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="stdint_8h.html#a57">int16_t</a> </td> <td class="mdname1" valign="top" nowrap> <em>inputValue</em> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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>.<p><pre class="fragment"><div>00110 {00111 ;00112 }</div></pre> </td> </tr></table><a class="anchor" name="a6" doxytag="main.c::TIMER0_OVF_ISR" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> __interrupt void TIMER0_OVF_ISR </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top">void </td> <td class="mdname1" valign="top" nowrap> </td> <td class="md" valign="top"> ) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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#a4">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>, <a class="el" href="pid_8h-source.html#l00059">TRUE</a>, and <a class="el" href="stdint_8h-source.html#l00029">uint16_t</a>.<p><pre class="fragment"><div>00063 {00064 <span class="keyword">static</span> <a class="code" href="stdint_8h.html#a58">uint16_t</a> i = 0;00065 <span class="keywordflow">if</span>(i < <a class="code" href="main_8c.html#a3">TIME_INTERVAL</a>)00066 i++;00067 <span class="keywordflow">else</span>{00068 <a class="code" href="main_8c.html#a4">gFlags</a>.<a class="code" href="structGLOBAL__FLAGS.html#o1">pidTimer</a> = <a class="code" href="pid_8h.html#a5">TRUE</a>;00069 i = 0;00070 }00071 }</div></pre> </td> </tr></table><hr><h2>Variable Documentation</h2><a class="anchor" name="a4" doxytag="main.c::gFlags" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> struct <a class="el" href="structGLOBAL__FLAGS.html">GLOBAL_FLAGS</a> <a class="el" href="main_8c.html#a4">gFlags</a> </td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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>. </td> </tr></table><a class="anchor" name="a5" doxytag="main.c::pidData" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> struct <a class="el" href="structPID__DATA.html">PID_DATA</a> <a class="el" href="main_8c.html#a5">pidData</a> </td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><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>. </td> </tr></table><hr size="1"><address style="align: right;"><small>Generated on Thu Feb 16 16:22:41 2006 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.3.7 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -