Hi,
As far as I understand you are trying to reconstruct the input waveform through the PWM output. Probably your code is working fine but you are not being able to visualize it due to triggering issues on the oscilloscope. Try using a R-C low pass filter at the output. If you are using a DSO change the acquisition to average sample. Better even select the trigger to be a different channel with the input analogue and adjust timebase according to the input.
This would be just a step as a proof of concept.




Bookmarks