Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
The quick answer is that to convert a PWM signal to a DC analogue signal, you just need a low pass filter which has a time constant which is long compared with the period of the PWM.
A simple RC network will do the job. You don't need a PIC to do the conversion.
However, the devil is in the detail.
Where does the PWM signal come from?
What does the PWM signal represent?
What does the analogue signal feed into?
Thanks for your attention Sir, I'm planning to get analog voltage value from a PWM type fuel sensors. The vehicle's Body Control Module send PWM with 10 Hz frequency to vehicle's fuel sender unit (which actually was a rheostat). I want to convert this PWM signals to analog voltage which will change by the fuel level. I draw a sketch and uploaded.
Old car 'electronics' used a crude electro/mechanical 'regulator' to provide a regulated voltage for the instrument panel - but this is only the power supply for the instruments, and not an actual data signal. To add any actual electronics to the instrument panel you need to replace the crude pulsed 'regulator' with a proper DC electronic one.
Thanks you all for your times and attention, it's was a Suzuki , Ertiga 2017 model. As I already posted, this car take the fuel sender unit status using a pulse with 10 Hz which comes from Body Control Unit. I haven't enough knowledge to manipulate the BCM to get the fuel status and so , I tried to convert this pulse signals to analog voltage and then , calibrate fuel amount with converted analog voltage. I've to admit that I have tested it wrongly and one of my colleagues messed some wiring and the result was built-in fuel gauge gone!