G'Day Marlin,
Doing that would be essentially the same as PWM. You're just adjusting the
duty cycle of a waveform, which is then converted into an analogue voltage
via a low pass filter.
The easiest way, in my mind, would be the R2R network. But... If you'd
like to do the LPF thing, I'd go with PWM. You just have to choose your
PWM frequency high enough that its a fair bit higher than your maximum
output frequency. Then you have to choose your LPF cutoff such that it
will pass your maximum output frequency, but attenuate the PWM frequencies.
Talk to you soon,
Dave.
On Friday, July 26, 2002, at 10:35 PM, Marlin Unruh wrote:
Peter,
The R2R ladder network was one thing I was thinking about. Then use a
lookup table of values to place on the port connected to the R2R network
at a given time duration. This may be the solution.
I was also wandering if I could use the SPI output pin and shift out bit
patterns and run them through a RC filter. If you sent out a series of
zeros the voltage would go to ground, or a series of ones the voltage
would go to VCC. If you keep shifting out 10101010 thru the RC filter the
voltage would go to VCC/2, with some ripple. The RC filter would need to
be matched to the clock rate on the SPI MOSI pin. This may not take that
much overhead for the processor depending on the clock rate of the SPI. I
would use the SPI data register empty interrupt to feed the SPI data register.
Does that sound stupid? Although for me it would cause some problem
because I need the SPI port to communicate with another micro controller
on the same PCB. I will have to think about it.
Thanks again. :-)
Marlin
At 07:41 AM 7/26/2002 +0200, you wrote:
How about this:
http://www.myplace.nu/avr/minidds/
Always been meaning to try it out :-)
>>> Marlin Unruh <address@hidden> 07/26/02 03:51AM >>>
Hi,
I am needing to generate a sine wave using an AVR. The sine wave needs
to
change in frequency between 1500Hz to 5500Hz approx. Is there a mostly
digital solution? I could use an AVR that basically had nothing else to
do
but read a port as input and generate the sine wave. Using a resistor
and
capacitor on the PWM output for a wave shaper really wouldn't work
because
the frequency isn't constant. Right?
I have several ideas,but think I am making it more complex that it
really is.
I hope I'm not abusing this forum with this question!
Any pointers would be appreciated.
Marlin
avr-gcc-list at http://avr1.org
avr-gcc-list at http://avr1.org
avr-gcc-list at http://avr1.org
avr-gcc-list at http://avr1.org