Page 1 of 1

PIC analogue output

Posted: Thu Jan 29, 2009 10:17 am
by echase
Can’t find a Microchip Application Note on how to do an accurate analogue output. I postulate that using a PWM output smoothed with a capacitor gives an approximate output. If I want it accurate I can read the capacitor voltage with an analogue input, then fine tune the PWM to achieve the exact voltage needed. Successive approximation is the technical term for this I think.

Doing this slowly may not be too difficult. My response required time is about 0.1 secs. But doing it faster whilst avoid oscillation /instability, especially when the PIC has to fit in other tasks along the way, would be a challenge.

Anyone got a standard Flowcode routine to do this?

Beats me why no/few PICs have analogue outputs. If the answer is because the above is easy to do why do Microchip not make it more public how to do it.

Re: PIC analogue output

Posted: Thu Jan 29, 2009 12:25 pm
by Benj
Hello

Sounds like an interesting project. Also sounds like PID would plug into this quite well and save you some time with messing around with successive approximation. PWM is the common method for a analogue output and is why PWM hardware is now built into most devices.

I thought that Microchip had released something about how to do this ... and here it is.

http://www.microchip.com/stellent/idcpl ... e=en011079

If you need the PID equasion then Ill grab it from home and explain it. Should be quite easy to set up what you require. Tricky bit will be tuning the P, I and D parameters to give a responsive and stable system.

Re: PIC analogue output

Posted: Thu Jan 29, 2009 10:08 pm
by chevy6600
Hi echase, you may find this info of some interest, i found it on the internet a while ago, it shows the different
methods DAC can be done along with the pro`s and cons.
http://www.faqs.org/docs/electric/Digital/DIGI_13.html