On Thu, 17 May 2001, Freddie Leaf wrote: > Hi PICList, > > I need to generate a sine wave signal for input to an existing electronic > circuit. The signal will vary in frequency as a function of some other inputs > to a 16F877. I'm thinking I could generate a 0V to 5V output pulse with the > PIC but need a circuit to convert this signal to a +/- sine wave. The > peak-to-peak voltage has to be a least 2.0V. > > I've experimented with a cap in series with the PIC output, and a resistor to > ground. This generates a nice positive and negative spike with clean zero > crossings but this is not good enough. The device I am sending the signal to > is also looking at the slew rate of the signal. I need a relatively genuine > sine wave. > > Thanks in advance if you have an ideas. Instead of filtering a single pulse, you'd be better off filtering a pulse stream. All you need to do is generate a series of pulses whose widths are proportional to the sine wave amplitude. Low-pass filter this stream, and you're done. Since you're using the 'F877, you can use the on chip PWM peripheral to generate the pulse for you. To obtain the sinusoidal proportional widths, you can try this: http://www.dattalo.com/technical/software/pic/picsine.html Scott -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads