📄 main_8c.html
字号:
Referenced by <a class="el" href="main_8c-source.html#l01030">Timer1CaptureISR()</a>.<div class="fragment"><pre class="fragment"><a name="l00817"></a>00817 {<a name="l00818"></a>00818 <span class="keywordflow">if</span> (<a class="code" href="main_8c.html#a3">commutationTicks</a> < <a class="code" href="PMSM_8h.html#a34">COMMUTATION_TICKS_STOPPED</a>)<a name="l00819"></a>00819 {<a name="l00820"></a>00820 <a class="code" href="main_8c.html#a3">commutationTicks</a>++;<a name="l00821"></a>00821 }<a name="l00822"></a>00822 <span class="keywordflow">else</span><a name="l00823"></a>00823 {<a name="l00824"></a>00824 fastFlags.motorStopped = <a class="code" href="pid_8h.html#a5">TRUE</a>;<a name="l00825"></a>00825 fastFlags.motorSynchronized = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l00826"></a>00826 <span class="keywordflow">if</span> (fastFlags.driveWaveform != <a class="code" href="PMSM_8h.html#a30">WAVEFORM_BLOCK_COMMUTATION</a>)<a name="l00827"></a>00827 {<a name="l00828"></a>00828 <a class="code" href="main_8c.html#a18">TimersSetModeBlockCommutation</a>();<a name="l00829"></a>00829 <a class="code" href="main_8c.html#a24">BlockCommutate</a>(<a class="code" href="main_8c.html#a22">GetDesiredDirection</a>(), <a class="code" href="main_8c.html#a25">GetHall</a>());<a name="l00830"></a>00830 <a name="l00831"></a>00831 <span class="preprocessor">#if (SPEED_CONTROL_METHOD == SPEED_CONTROL_CLOSED_LOOP)</span><a name="l00832"></a>00832 <span class="preprocessor"></span> <a class="code" href="pid_8c.html#a2">PID_Reset_Integrator</a>(&pidParameters);<a name="l00833"></a>00833 <span class="preprocessor">#endif</span><a name="l00834"></a>00834 <span class="preprocessor"></span> }<a name="l00835"></a>00835 }<a name="l00836"></a>00836 }</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_a36_cgraph.png" border="0" usemap="#main_8c_a36_cgraph_map" alt=""></center><map name="main_8c_a36_cgraph_map"><area href="main_8c.html#a24" shape="rect" coords="281,6,407,32" alt=""><area href="main_8c.html#a22" shape="rect" coords="273,56,415,83" alt=""><area href="main_8c.html#a25" shape="rect" coords="311,107,377,134" alt=""><area href="pid_8c.html#a2" shape="rect" coords="269,158,419,184" alt=""><area href="main_8c.html#a18" shape="rect" coords="229,208,459,235" alt=""><area href="main_8c.html#a35" shape="rect" coords="536,56,683,83" alt=""><area href="main_8c.html#a21" shape="rect" coords="519,158,700,184" alt=""><area href="main_8c.html#a34" shape="rect" coords="537,208,681,235" alt=""><area href="main_8c.html#a20" shape="rect" coords="507,259,712,286" alt=""></map> </td> </tr></table><a class="anchor" name="a26"></a><!-- doxytag: member="main.c::DesiredDirectionUpdate" ref="a26" 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">( </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><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </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#l00572">572</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="PMSM_8h-source.html#l00128">DIRECTION_COMMAND_PIN</a>, <a class="el" href="PMSM_8h-source.html#l00061">DIRECTION_FORWARD</a>, and <a class="el" href="PMSM_8h-source.html#l00064">DIRECTION_REVERSE</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00999">DirectionInputChangeISR()</a>, and <a class="el" href="main_8c-source.html#l00135">main()</a>.<div class="fragment"><pre class="fragment"><a name="l00573"></a>00573 {<a name="l00574"></a>00574 <span class="keywordflow">if</span> ( (PIND & (1 << <a class="code" href="PMSM_8h.html#a26">DIRECTION_COMMAND_PIN</a>)) != 0 )<a name="l00575"></a>00575 {<a name="l00576"></a>00576 fastFlags.desiredDirection = <a class="code" href="PMSM_8h.html#a8">DIRECTION_REVERSE</a>;<a name="l00577"></a>00577 }<a name="l00578"></a>00578 <span class="keywordflow">else</span><a name="l00579"></a>00579 {<a name="l00580"></a>00580 fastFlags.desiredDirection = <a class="code" href="PMSM_8h.html#a7">DIRECTION_FORWARD</a>;<a name="l00581"></a>00581 }<a name="l00582"></a>00582 }</pre></div><p> </td> </tr></table><a class="anchor" name="a41"></a><!-- doxytag: member="main.c::DirectionInputChangeISR" ref="a41" 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">__interrupt void DirectionInputChangeISR </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>Direction input change interrupt service routine. <p>This ISR is called every time the direction input pin changes state. The desired direction flag is updated accordingly. The motor control then goes into a state where it needs a stopped motor or a synchronization before any driving of the motor is performed.<p>Definition at line <a class="el" href="main_8c-source.html#l00999">999</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="main_8c-source.html#l00572">DesiredDirectionUpdate()</a>, <a class="el" href="main_8c-source.html#l00800">DisablePWMOutputs()</a>, <a class="el" href="pid_8h-source.html#l00079">FALSE</a>, <a class="el" href="main_8c-source.html#l00404">TimersSetModeBrake()</a>, and <a class="el" href="PMSM_8h-source.html#l00158">WAVEFORM_UNDEFINED</a>.<div class="fragment"><pre class="fragment"><a name="l01000"></a>01000 {<a name="l01001"></a>01001 <span class="comment">//Update desired direction flag.</span><a name="l01002"></a>01002 <a class="code" href="main_8c.html#a26">DesiredDirectionUpdate</a>();<a name="l01003"></a>01003 <a name="l01004"></a>01004 <span class="preprocessor">#if (TURN_MODE == TURN_MODE_COAST)</span><a name="l01005"></a>01005 <span class="preprocessor"></span> <span class="comment">//Disable driver signals to let motor coast. The motor will automatically</span><a name="l01006"></a>01006 <span class="comment">//start once it is synchronized or stopped.</span><a name="l01007"></a>01007 <a class="code" href="main_8c.html#a35">DisablePWMOutputs</a>();<a name="l01008"></a>01008 fastFlags.motorSynchronized = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l01009"></a>01009 fastFlags.motorStopped = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l01010"></a>01010 fastFlags.driveWaveform = <a class="code" href="PMSM_8h.html#a33">WAVEFORM_UNDEFINED</a>;<a name="l01011"></a>01011 <span class="preprocessor">#endif</span><a name="l01012"></a>01012 <span class="preprocessor"></span><a name="l01013"></a>01013 <span class="preprocessor">#if (TURN_MODE == TURN_MODE_BRAKE)</span><a name="l01014"></a>01014 <span class="preprocessor"></span> <span class="comment">//Set motor in brake mode. The motor will automatically start once it is</span><a name="l01015"></a>01015 <span class="comment">//synchronized or stopped.</span><a name="l01016"></a>01016 fastFlags.motorSynchronized = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l01017"></a>01017 fastFlags.motorStopped = <a class="code" href="pid_8h.html#a4">FALSE</a>;<a name="l01018"></a>01018 <a class="code" href="main_8c.html#a19">TimersSetModeBrake</a>(); <span class="comment">// Automatically sets driveWaveform.</span><a name="l01019"></a>01019 <span class="preprocessor">#endif</span><a name="l01020"></a>01020 <span class="preprocessor"></span>}</pre></div><p><p>Here is the call graph for this function:<p><center><img src="main_8c_a41_cgraph.png" border="0" usemap="#main_8c_a41_cgraph_map" alt=""></center><map name="main_8c_a41_cgraph_map"><area href="main_8c.html#a26" shape="rect" coords="228,5,391,32" alt=""><area href="main_8c.html#a35" shape="rect" coords="470,56,616,83" alt=""><area href="main_8c.html#a19" shape="rect" coords="235,107,384,133" alt=""><area href="main_8c.html#a34" shape="rect" coords="471,107,615,133" alt=""><area href="main_8c.html#a20" shape="rect" coords="440,157,646,184" alt=""></map> </td> </tr></table><a class="anchor" name="a35"></a><!-- doxytag: member="main.c::DisablePWMOutputs" ref="a35" 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">( </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><code> [static]</code></td> </tr> </table> </td> </tr></table><table cellspacing="5" cellpadding="0" border="0"> <tr> <td> </td> <td><p>Disables PWM output pins. <p>This function disables PWM outputs by setting the port dierction for all PWM pins as inputs, thus overriding the PWM. The PWM configuration itself is not altered in any way by running this function.<p>Definition at line <a class="el" href="main_8c-source.html#l00800">800</a> of file <a class="el" href="main_8c-source.html">main.c</a>.<p>References <a class="el" href="PMSM_8h-source.html#l00055">PWM_PATTERN_PORTB</a>, and <a class="el" href="PMSM_8h-source.html#l00058">PWM_PATTERN_PORTD</a>.<p>Referenced by <a class="el" href="main_8c-source.html#l00520">BlockCommutate()</a>, <a class="el" href="main_8c-source.html#l00999">DirectionInputChangeISR()</a>, <a class="el" href="main_8c-source.html#l00901">EmergencyInterruptISR()</a>, <a class="el" href="main_8c-source.html#l00373">TimersSetModeBlockCommutation()</a>, <a class="el" href="main_8c-source.html#l00404">TimersSetModeBrake()</a>, and <a class="el" href="main_8c-source.html#l00341">TimersSetModeSinusoidal()</a>.<div class="fragment"><pre class="fragment"><a name="l00801"></a>00801 {<a name="l00802"></a>00802 DDRB &= ~<a class="code" href="PMSM_8h.html#a5">PWM_PATTERN_PORTB</a>;<a name="l00803"></a>00803 DDRD &= ~<a class="code" href="PMSM_8h.html#a6">PWM_PATTERN_PORTD</a>;<a name="l00804"></a>00804 }</pre></div><p> </td> </tr></table><a class="anchor" name="a39"></a><!-- doxytag: member="main.c::EmergencyInterruptISR" ref="a39" 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">__interrupt void EmergencyInterruptISR </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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -