I recently encountered the idea of Phase-Shifted PWM. I thought it quite odd but read up enough to realize it has its uses.
When I thought about how it could be done using RTM_TimerCalc, I got an idea using 4 16 bit Timers in the Mega.
So, I mapped out a plan, built up a single breadboard prototype then genned up some code. Darn thing works quite good!
Its uses a static 120 degree shift for 3 Timers (1, 3, and 4). Timer5 is used to start Timer3 @120 degrees, and Timer4 @240 degrees. I only have a dual-trace scope but I'm quite certain all Timers are holding 120 degree separation.
This example uses 1000 Hz as the frequency. But I figure it can go to 30kHz with a PWM resolution of 9-bits or so.
More soon...
Lee
Created: Aug 28, 2022 Updated: Oct 6, 2022 |