not quite understand the idea if you're needing, but I work with a MAP for a car, what I did was to implement a hardware PWM (in the background) and a TMR0 interrupt.
Within the interrupt, which is to read the ADC and modified the pwm ...
With all this, I required no implementing a LOOP and my program was much more efficient

Note: (do not know if the translation is fine >> background = the 2nd plane?)