Multi-channel High Frequency PWM with registers and phase shift capabilities

Hi there @tonytt98,

Have a look to pwm_lib available at:

The library provides two kind of objects associated with each PWM channel: pwm and servo objects. As those objects abstract the PWM channels available on the micro controller, using pwm_lib you can use, at most, eight independent pwm_lib objects in your application, each one with its own PWM characteristics (PWM signal period and pulse duration). In its current version, the maximum period for PWM signals you can get using pwm_lib is a period of 0.798915048 seconds (minimum frequency of 1.251697539 Hz). The maximum frequency you can get is the one provided by the hardware. I see no problems even to get to 1 Mhz but in this case the resolution of the duty will be limited to 84 clock ticks, at 2 Mhz 42 ticks, etc.

Have a look to the examples which come with pwm_lib.

I hope it helps.