
Originally Posted by
Wirecut
I never stop to thaks Darrel for he very useful SPWM.
You are very Welcome Leo. Glad you could use it. 
Using it, I have found the necessity to stop and then later start or restart restart the SPWM having the same value for each SPWM channel.
During the stop period all the channels/pin should be set high or low a desidered.
Could you please suggest the best way to stop and start the SPWM.
Well,
Just stopping the Timer or Disabling the interrupt will leave everything in mid-cycle.
Then turning the Timer back on later will cause all channels to finish the cycle it was in the middle of, and continue with the dutycycle last assigned.
I think the best way is to set all the DutyCycles to either 0 or the Max Res +1. Which will give an orderly "Stop" at the end of the Cycle.
If the DutyCycle variables are grouped in an array like shown in my original examples, then you can just do a FOR loop, to assign them all to the same value.
Code:
For i = 0 to 4
DutyVars[i] = 0
Next i
<br>
Bookmarks