You can certainly do a software PWM at those frequencies. Just think of a pin thats off 100% of the time, on 50%, off 50%, or on 100%. That should be pretty easy with any timer. You would make the R-C time constant many times the period of the PWM repetition period. There is LOTS of lattitude in the choice. Normally, a PWM is made fairly high in frequency so you don't have to use big caps. A 1K resistor and a 1uf cap only has a time constant of 1ms. You probably would NOT want to use that combo with a PWM frequency below 10KHz (period = 0.1ms). I'm not very clear how the second part ties in with the first, if it even does. A square-wave from an external clock is really easy. Triangle not. Square wave would be to have the port pin on for so many clocks, and off for the same number. Feed variable frequency clock and out comes the square wave at some integer division of the input frequency. Triangle means either a many-bit dac to simulate the steady rise and fall of the triangle OR using an external circuit to shape the signal from the micro into a triangle. The BIG problem is your desire for variable frequency. You really can't get there from here with fixed R and C values. Drop me a line if you need more info. Jim Wagner Corvallis, OR On Wed, 17 Nov 2004 23:59:42 -0000 "alan_probandt" <alan_probandt@yahoo.com> wrote: > > Hello, > I'm interested in implementing a super cheap DAC > (1 or 2 resistors > and a capacitor) on an output pin of a Tiny 11 AVR. > This AVR has no > Pulse Width Modulation register/timer that would normally > be used to > implement a pseudo-DAC like this. > Any anyone done this? Are there optimal > resistor/capacitor values? > I'd like to make an adjustable very low frequency > oscillator (0.1 to > 5 Hz triangle or sine wave) between +2.5 and 4 > volts. I'd also like > to make its speed controllable by changing the external > system clock > speed that is fed into the Tiny 11. > I'm not even sure what keywords to use for a > Google search on this > one. > > Thanks, > Alan Probandt > Portland, Oregon USA > > > > > > > > > > > > > Yahoo! Groups Sponsor > > > ADVERTISEMENT > > > > > > > > > > > > > Yahoo! Groups Links > > To visit your group on the web, go > to:http://groups.yahoo.com/group/AVR-Chat/ > To unsubscribe from this group, send an email > to:AVR-Chat-unsubscribe@yahoogroups.com > Your use of Yahoo! Groups is subject to the Yahoo! Terms > of Service. > > > > > > > > > > > --------------------------------------------------------------- The Think Different Store http://www.thinkdifferentstore.com/ For All Your Mac Gear ---------------------------------------------------------------
Message
Re: [AVR-Chat] 1-bit DAC on AVR with no PWM
2004-11-18 by Jim Wagner
Attachments
- No local attachments were found for this message.