Hello Shiva,
What you are attempting to do using the sawtooth and comparator seems to be to generate a pulse width that is proportional to a DC analog voltage. Could you not achieve a similar operation by controlling the PWM output from a TPM module, with the pulse width determined by an ADC result?
However, if you really need to generate a step-wise approximation to a sawtooth waveform, using digital techniques, you would need a suitable DAC function, which may require an external device. Unless the sawtooth frequency is extremely low, I don't think that it would be feasible to use a filtered PWM output for the sawtooth because of the heavy analog filtering required, and the distortion this would produce at the flyback point.
Regards,
Mac
Hello,
Running a comparator on an adjustable voltage and the output of a TRIANGLE wave generator is the old school method of producing PWM. It is totally unclear to me why you would be involving this method along with a microcontroller. Perhaps some further details of what you are trying to do would be in order.