At 11:58 PM 5/7/03 +0200, Stef wrote: >hi All, > >I wondered if it was possible to create a DAC with just 1 ADC pin. >The reason is that I have just a few pins and pwm is too slow. Robert Rolf suggested a method to me many, many years ago: 100R from pin to 1u0 cap +. Other side of cap is Gnd. Output voltage comes from cap +. This is a high impedance output - buffer as required. Read the voltage on the pin and compare to the desired value, then set the pin as output (either HI or LO, as required) for a very short period to 'nudge' the voltage in right direction. The voltage on the cap will track the desired value. The requires frequent reading of the ADC - stick the routine in your background task. It is possible to make this reasonably fast: make the output pulse width wider as you get farther away from the desired value. A simple subtract and some right shifts to approximate the required delay time is all that is needed. I've been told this works quite well. dwayne -- Dwayne Reid Trinity Electronics Systems Ltd Edmonton, AB, CANADA (780) 489-3199 voice (780) 487-6397 fax Celebrating 19 years of Engineering Innovation (1984 - 2003) .-. .-. .-. .-. .-. .-. .-. .-. .-. .- `-' `-' `-' `-' `-' `-' `-' `-' `-' Do NOT send unsolicited commercial email to this email address. This message neither grants consent to receive unsolicited commercial email nor is intended to solicit commercial email. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads