is it possible to have two independent PWM outputs on an AVR, let's say MEGA2560, with different duty cycles that can be triggered in sequence?
To give you an example, both outputs have the same base frequency of 100Khz, first PWM output has a duty of 30% on and 70% off. The second output will be triggered after the end of the first pulse on it's on duty cycle.. let's say 50% on and 50% off.
My thought is this:
Let's say, at 100Khz.. it's a total period of 10uS for both outputs, 5uS goes to first output and 5uS to second output. The first output with a duty cycle of 30% must stay HIGH for 1.5uS and then 3.5uS LOW then second output goes HIGH again for 2.5uS (50% duty) and off for 2.5uS.
Is this approach correct? If so, the problem is that i can't make it work in software with a timer and interrupt because it's too slow for these timings.
Can you thought of any way to implement this sequence using hardware PWM?