The CalcSPWM: routine calculates the prescaler and ON/OFF times for the PWM.
Then the Timer interrupts do the rest.
You can calculate those times any way you want.
SSPWM calculates for different OSC frequencies, PWM frequencies and dutycycles.
But if you know the OSC and PWM frequency ahead of time, it will be easier for you to do the math.




Bookmarks