⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_8c.html

📁 ATtiny261 461 861 这份资料介绍了执行Attiny261 461 861微控制器系列正弦波驱动三相无刷直流电动机霍尔传感器。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<a name="l00463"></a>00463     TCCR1E = <a class="code" href="PMSM__tables_8h.html#a2">blockCommutationTableReverse</a>[hall];<a name="l00464"></a>00464   }<a name="l00465"></a>00465 }</pre></div><p>    </td>  </tr></table><a class="anchor" name="a18"></a><!-- doxytag: member="main.c::BlockCommutationSetDuty" ref="a18" args="(const uint16_t compareValue)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">static void BlockCommutationSetDuty           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">const <a class="el" href="stdint_8h.html#a58">uint16_t</a>&nbsp;</td>          <td class="mdname1" valign="top" nowrap> <em>compareValue</em>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Sets the duty cycle when operating in block commutation mode. <p>Calling this function sets the duty cycle when operating in block commutation mode (PWM6 mode). Do not use this function when Timer/counter1 is not operated in PWM6 mode.<p>Note that the argument specifies the output compare value, not the duty cycle in percent. The duty cycle in percent can be calculated as duty = (compareValue / PWM_TOP_VALUE) * 100.<p><dl compact><dt><b>Parameters:</b></dt><dd>  <table border="0" cellspacing="2" cellpadding="0">    <tr><td valign="top"></td><td valign="top"><em>compareValue</em>&nbsp;</td><td>Ouput compare value.</td></tr>  </table></dl><p>Definition at line <a class="el" href="main_8c-source.html#l00420">420</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="PMSM_8h-source.html#l00310">TC1_PWM6_SET_DUTY_CYCLE</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00965">Timer1OverflowISR()</a>, and <a class="el" href="main_8c-source.html#l00353">TimerSetModeBlockCommutation()</a>.<div class="fragment"><pre class="fragment"><a name="l00421"></a>00421 {<a name="l00422"></a>00422   <a class="code" href="PMSM_8h.html#a55">TC1_PWM6_SET_DUTY_CYCLE</a>(compareValue);<a name="l00423"></a>00423 }</pre></div><p>    </td>  </tr></table><a class="anchor" name="a29"></a><!-- doxytag: member="main.c::CommutationTicksUpdate" ref="a29" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">static void CommutationTicksUpdate           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Updates the 'tick' counter and checks for stopped motor. <p>This function should be run at every PWM timer overflow to ensure that all 'ticks' are counted. It increases the 'tick' counter until it reaches the maximum tick limit that corresponds to what is considered a stopped or stalled motor. In that case, the global motor stopped flag is set.<p>Definition at line <a class="el" href="main_8c-source.html#l00643">643</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="main_8c-source.html#l00455">BlockCommutate()</a>, <a class="el" href="PMSM_8h-source.html#l00185">COMMUTATION_TICKS_STOPPED</a>, <a class="el" href="main_8c-source.html#l00074">commutationTicks</a>, <a class="el" href="pid_8h-source.html#l00058">FALSE</a>, <a class="el" href="main_8c-source.html#l00437">GetDesiredDirection()</a>, <a class="el" href="main_8c-source.html#l00484">GetHall()</a>, <a class="el" href="pid_8c-source.html#l00117">pid_Reset_Integrator()</a>, <a class="el" href="main_8c-source.html#l00055">sineTableIncrement</a>, <a class="el" href="main_8c-source.html#l00353">TimerSetModeBlockCommutation()</a>, <a class="el" href="pid_8h-source.html#l00059">TRUE</a>, and <a class="el" href="PMSM_8h-source.html#l00197">WAVEFORM_BLOCK_COMMUTATION</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00965">Timer1OverflowISR()</a>.<div class="fragment"><pre class="fragment"><a name="l00644"></a>00644 {<a name="l00645"></a>00645   <span class="keywordflow">if</span> (<a class="code" href="main_8c.html#a3">commutationTicks</a> &lt; <a class="code" href="PMSM_8h.html#a36">COMMUTATION_TICKS_STOPPED</a>)<a name="l00646"></a>00646   {<a name="l00647"></a>00647     <a class="code" href="main_8c.html#a3">commutationTicks</a>++;<a name="l00648"></a>00648   }<a name="l00649"></a>00649   <span class="keywordflow">else</span><a name="l00650"></a>00650   {<a name="l00651"></a>00651     fastFlags.motorStopped = <a class="code" href="pid_8h.html#a5">TRUE</a>;<a name="l00652"></a>00652     fastFlags.motorSynchronized = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l00653"></a>00653     <a class="code" href="main_8c.html#a1">sineTableIncrement</a> = 0;<a name="l00654"></a>00654     <span class="keywordflow">if</span> (fastFlags.driveWaveform != <a class="code" href="PMSM_8h.html#a38">WAVEFORM_BLOCK_COMMUTATION</a>)<a name="l00655"></a>00655     {<a name="l00656"></a>00656       <a class="code" href="main_8c.html#a16">TimerSetModeBlockCommutation</a>();<a name="l00657"></a>00657       <a class="code" href="main_8c.html#a20">BlockCommutate</a>(<a class="code" href="main_8c.html#a19">GetDesiredDirection</a>(), <a class="code" href="main_8c.html#a21">GetHall</a>());<a name="l00658"></a>00658 <a name="l00659"></a>00659 <span class="preprocessor">#if (SPEED_CONTROL_METHOD == SPEED_CONTROL_CLOSED_LOOP)</span><a name="l00660"></a>00660 <span class="preprocessor"></span>      <a class="code" href="pid_8c.html#a2">pid_Reset_Integrator</a>(&amp;pidParameters);<a name="l00661"></a>00661 <span class="preprocessor">#endif</span><a name="l00662"></a>00662 <span class="preprocessor"></span>    }<a name="l00663"></a>00663   }<a name="l00664"></a>00664 }</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_a29_cgraph.png" border="0" usemap="#main_8c_a29_cgraph_map" alt=""></center><map name="main_8c_a29_cgraph_map"><area href="main_8c.html#a20" shape="rect" coords="279,6,404,32" alt=""><area href="main_8c.html#a19" shape="rect" coords="271,56,412,83" alt=""><area href="main_8c.html#a21" shape="rect" coords="308,107,375,134" alt=""><area href="pid_8c.html#a2" shape="rect" coords="268,158,415,184" alt=""><area href="main_8c.html#a16" shape="rect" coords="231,208,452,235" alt=""><area href="main_8c.html#a18" shape="rect" coords="503,158,684,184" alt=""><area href="main_8c.html#a28" shape="rect" coords="520,208,667,235" alt=""><area href="main_8c.html#a27" shape="rect" coords="522,259,666,286" alt=""></map>    </td>  </tr></table><a class="anchor" name="a22"></a><!-- doxytag: member="main.c::DesiredDirectionUpdate" ref="a22" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">static void DesiredDirectionUpdate           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Updates global desired direction flag. <p>Running this function triggers a reading of the direction input pin. The desiredDirection flag is set accordingly.<p>Definition at line <a class="el" href="main_8c-source.html#l00500">500</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="PMSM_8h-source.html#l00141">DIRECTION_FORWARD</a>, <a class="el" href="PMSM_8h-source.html#l00109">DIRECTION_PIN</a>, and <a class="el" href="PMSM_8h-source.html#l00144">DIRECTION_REVERSE</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00120">main()</a>, and <a class="el" href="main_8c-source.html#l00965">Timer1OverflowISR()</a>.<div class="fragment"><pre class="fragment"><a name="l00501"></a>00501 {<a name="l00502"></a>00502   <span class="keywordflow">if</span> ( (PINA &amp; (1 &lt;&lt; <a class="code" href="PMSM_8h.html#a16">DIRECTION_PIN</a>)) != 0 )<a name="l00503"></a>00503   {<a name="l00504"></a>00504     fastFlags.desiredDirection = <a class="code" href="PMSM_8h.html#a28">DIRECTION_REVERSE</a>;<a name="l00505"></a>00505   }<a name="l00506"></a>00506   <span class="keywordflow">else</span><a name="l00507"></a>00507   {<a name="l00508"></a>00508     fastFlags.desiredDirection = <a class="code" href="PMSM_8h.html#a27">DIRECTION_FORWARD</a>;<a name="l00509"></a>00509   }<a name="l00510"></a>00510 }</pre></div><p>    </td>  </tr></table><a class="anchor" name="a28"></a><!-- doxytag: member="main.c::DisablePWMOutputs" ref="a28" args="(void)" --><p><table class="mdTable" cellpadding="2" cellspacing="0">  <tr>    <td class="mdRow">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td class="md" nowrap valign="top">static void DisablePWMOutputs           </td>          <td class="md" valign="top">(&nbsp;</td>          <td class="md" nowrap valign="top">void&nbsp;</td>          <td class="mdname1" valign="top" nowrap>          </td>          <td class="md" valign="top">&nbsp;)&nbsp;</td>          <td class="md" nowrap><code> [static]</code></td>        </tr>      </table>    </td>  </tr></table><table cellspacing="5" cellpadding="0" border="0">  <tr>    <td>      &nbsp;    </td>    <td><p>Disable PWM outputs by setting the port direction to input. <p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -