On Wed, 20 Mar 2002, shawn wrote: > I'm looking for some opinions and perhaps suggestions. I would like to > replace a 625Hz analog sine wave oscillator with a low-end PIC > microcontroller -- say 16F84 or 8-pin model. Is it better to use a > look-table approach to replicate the sine wave or can excellent > results be achieved by generating a square wave then filtering? Any > advice on the second approach would be appreciated. And finally, would > the answer change if I were generating say a 1MHz wave? First question: lookup table plus filter is definitely better. Second question: yes, if you want to use a PIC. It's quite easy to generate a pulse train devoid of the 2nd, 3rd and 4th harmonics. This greatly reduces the filter requirements (suppressing the 3'rd harmonic of a square wave without affecting the fundamental is practically impossible). You can continue with an optimized pulse stream to minimize the first N harmonics. Or you can increase the complexity of the pulse stream and suppress the 2nd,3rd, 5th and all multiples of them. Check out: http://www.dattalo.com/technical/theory/sqwave.html and specifically usage number 011. This pulse stream, btw is devoid of 2nd, 3rd, and 4th harmonics. I don't recall how big the 5'th is. ^ v(t) | A| +--+ +--+ +--+ | | | | | | | -+--+ +--+ +-----------------------T--+ +-----> t 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 The idea is to run this through a cheesy low pass filter and you have a sine wave! Scott -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.