Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: AVR with DAC?

2004-10-27 by Dave Mucha

--- In AVR-Chat@yahoogroups.com, "Don Kinzer" <dkinzer@e...> wrote:
> 
> --- In AVR-Chat@yahoogroups.com, "Jim Wagner" <jim_d_wagner@a...> 
> wrote:
> > You don't need to mess with the ADC. The PWM is quite
> > accurate and very deterministic.
> 
> Also, if you only need the analog voltage for short periods of time 
> you can implement it completely in software, sort of a pseudo-PWM, 
> using an external RC filter for smoothing.  This can be done using 
> any digital output.  It's especially easy if you only need 8-bit 
> resolution.

if you send a PWM burst to an op-amp with a resistor, cap and 
resistor the output of the op-amp will be a value representing the 
duty cycle of the output voltage.   ie: if you are using 3.5 volts 
pwr and send a 50% duty cycle, the op-amp will output 1.75 volts.

I have not tested the duraton the cap will hold the charge on a AVR, 
but on a PIC if you change the pin status to input, there is no 
leakage and the cap will hold the charge for minutes with little or 
no change.   

If you need continual output change you can just alter the pwm duty 
cycle.   Resolution is based on duty cycle.

I have not tried it, but a mutilpe duty cycle should be able to 
double the resolution or even better. 

I have also thought about two output pins,  one with a course PWM and 
the other with a fine output.  Well, both would be the same, just one 
would go to one input of a quad op-amp with the stage set for a 10:1 
reduction and the other output sent to the op-amp input that would be 
a summing input  The op-amp would sum the inputs.  the raw value 
would but the course and the 10:1 reductio would offer the fine value.

For a test, try a 4.7k and a 10k resistor to an op-amp set as 1:1 
with a 0.47uF cap between them and ground. 

Dave

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.