Due Timers, PWM, Interrupts

Bit of a weird one I haven't figured out:

I need to run a periodic process at a fixed frequency (around 1-10 kHz), with several events happening at different duties/points along this cycle. Basically I am switching two transistors: one produces a PWM signal, another runs a measurement between the PWM pulses, and the two cannot be on at the same time.


  1. At the start of the cycle (0% duty), turn on a digital output pin.
  2. After a small delay (around 20% duty), run an interrupt routine to read an analog input, do some calculations, and turn off the digital output pin.
  3. After another delay (around 25% duty), turn on a second digital output pin.
  4. After a variable delay/duty cycle (IE between 25 and 95% duty), turn off the second digital output pin.

I am having trouble finding a good tutorial about configuring timer interrupts or the PWM generator to accomplish this.

Is there a way to do this all with several interrupt events at different counter values on one timer, or perhaps by some way to use multiple timer interrupts or PWM generators that are synchronized to each other?

Any help would be much appreciated. Thanks!