PIC analogue output

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times
Contact:

PIC analogue output

Post 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.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC analogue output

Post 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.

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: PIC analogue output

Post 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

Post Reply