Take your PWM, thru a Diode (1N4148 for example) so as not to affect the PWM downstream, thru a Resistor (say 10K) to charge a Capacitor (eg 1uF) connected down to 0v. The Capacitor will charge proportionately to the PWM value. 100% PWM will charge the Cap to 100%. 50% PWM will charge the Cap to 50% etc. Connect a PICs ADC across the Cap to sample the charge level and so determine the PWM. Use a Resistor PD if your PWM is greater than 5v. Compensate in software for the voltage drop across the Diode. No fancy software required...just read the ADC... Assuming you had 5v PWM to start with, 0.6v drop across the Diode, then 4.4v will be 100% PWM, 2.2v will be 50% PWM etc etc proportionately. Simple.
Bookmarks