"Don Lancaster" wrote in message
...
Bob Eld wrote:
"dave.harper" wrote in message
...
I'm trying to come up with a filter or converter that takes a square
wave input and outputs something closer to a sign wave (varying
between ~1.9kHz and 2.1kHz). It can have some distortion, but I'm
trying to eliminate the sharp leading and trailing edge. One option
I'm pursuing is a bandpass filter (2 caps and 2 resistors), which
looks to give a reasonable output, but still not quite as smooth as
I'd like. I've also considered using a counter feeding a bank of
resistors, but finding a method for it to start counting up with it
hits 0 and down when it hits the high value might be more difficult.
Originally, I had used a wein-bridge oscillator with op-amps to make
the sine wave, but due to the environment, EMI was a problem and it
damped out the oscillations (even with ferrite beads and modest
shielding). So I'd like to avoid using op-amps (since they are
apparently sensitive to EMI) if possible.
Any suggestions?
Thanks in advance!
Dave
I would make a five pole elliptic low pass active filter breaking at
about 3
kHz with a deep 80 dB notch at the third harmonic of 6 kHz. This is a
dual
op amp (2 section) solution and uses a small number of resistors and
caps.
You should be able to attenuate all of the harmonics at least 80 dB
leaving
a pretty good sine wave.
Parallax invented the ultimate in mind-numbingly simple sinewave
generators many years ago. SIX BYTES !!! of working code on a PIC!!!!
Start with page 85.3 of http://www.tinaja.com/glib/hackar4.pdf
--
Many thanks,
Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email:
Please visit my GURU's LAIR web site at http://www.tinaja.com
Thanks Don. Truly weird! I plan to code it up and play around with this when
time permits. So, the original poster could put this into a single chip PIC
and forget about his square wave source. He'd still need to run a D toA to
get an analog output, would he not? Within that algorithm he could also pull
out a square wave too if needed. Frequency could be anything within the
speed of the processor with appropriate, even externally controlled internal
delays and of course be crystal controlled and very stable. Hmmm. I already
have a use for this. Thanks again.
Bob