# Sine PWM using 16f877

Started by February 23, 2005
 hai all this is vijay from India wishing you a happy day i have a requirement to generate a Sine PWm using PIC 16f877. can anybody help me in developing the logic thanx in advance vijay
 Usually, PWM describes a pulse - a square wave with a particular frequency and duty cycle. This is not at all related to a sine wave (other than the sum of odd harmonics from the fundamental frequency to daylight). What, exactly, do you want the output to look like? FWIW, you can do an 8 bit D2A conversion using one of the output ports (maybe PORTB) and use a bunch of resistors to sum the voltages from the various bits. Look up R/2R ladders and such. Or just D to A conversion. Google can help. Then you can use the PIC and a lookup function to determine how to set the port outputs. You will have to decide how many 'slices' to put in each cycle and do the conversion at that frequency - many multiples of the desired output frequency. If the PIC can go that fast! Also, search the Microchip site. --- In , "p.vijayamurugan" wrote:> > hai all > > this is vijay from India > wishing you a happy day > > i have a requirement to generate a Sine PWm using PIC 16f877. > can anybody help me in developing the logic > thanx in advance > > vijay
Re: Sine PWM using 16f877
 I'm assuming you want to generate a sine wave using PWM techniques (followed by a low pass filter). Here are a few resources: http://www.sxlist.com/techref/io/pwm/harmonic.htm http://www.piclist.org/techref/microchip/dtmf.htm http://ww1.microchip.com/downloads/en/AppNotes/00655a.pdf http://ww1.microchip.com/downloads/en/AppNotes/00655.zip Harold -- FCC Rules Updated Daily at http://www.hallikainen.com
 I think what he is talking about is a sign wave generated by a constantly changing PWM width then filtering it. Jim ----- Original Message ----- From: rtstofer To: p...@yahoogroups.com Sent: Wednesday, February 23, 2005 1:27 PM Subject: [piclist] Re: Sine PWM using 16f877 Usually, PWM describes a pulse - a square wave with a particular frequency and duty cycle.  This is not at all related to a sine wave (other than the sum of odd harmonics from the fundamental frequency to daylight).What, exactly, do you want the output to look like?FWIW, you can do an 8 bit D2A conversion using one of the output ports (maybe PORTB) and use a bunch of resistors to sum the voltages from the various bits.  Look up R/2R ladders and such. Or just D to A conversion.  Google can help.Then you can use the PIC and a lookup function to determine how to set the port outputs.You will have to decide how many 'slices' to put in each cycle and do the conversion at that frequency - many multiples of the desired output frequency.  If the PIC can go that fast!Also, search the Microchip site.--- In p...@yahoogroups.com, "p.vijayamurugan" wrote:> > hai all> > this is vijay from India> wishing you a happy day> > i have a requirement to generate a Sine PWm using PIC 16f877.> can anybody help me in developing the logic> thanx in advance> > vijayto unsubscribe, go to http://www.yahoogroups.com and follow the instructions
 Good day, Generating sinusoidal signal with PWM it's a nice way. However there is another methode, less accurate then say DDS, less accurate than PWM generation but having a major advantage: it works on any PIC and it may control two parameters of the sinusoidal signal: amplitude and frequency. It requires two pic pins, one for generating the shape (a rectangular signal having the same frequency like sinus must have, followed by at least a third order low pass filter) and another pin (a filtered software PWM) which gaves the amplitude of the signal. Combining the amplitude with the frequency with an analogic multiplexer and voilla a complete control of a sinusoidal signal. Unfortunately it can't have the same frequency like DDS generation, but definitely is less expensive. best regards, Vasile --- In , "JCullins" wrote:> I think what he is talking about is a sign wave generated by a constantly changing PWM width then filtering it.> Jim > ----- Original Message ----- > From: rtstofer > To: > Sent: Wednesday, February 23, 2005 1:27 PM > Subject: [piclist] Re: Sine PWM using 16f877 > > > Usually, PWM describes a pulse - a square wave with a particular > frequency and duty cycle. This is not at all related to a sine wave > (other than the sum of odd harmonics from the fundamental frequency > to daylight). > > What, exactly, do you want the output to look like? > > FWIW, you can do an 8 bit D2A conversion using one of the output > ports (maybe PORTB) and use a bunch of resistors to sum the voltages > from the various bits. Look up R/2R ladders and such. Or just D to > A conversion. Google can help. > > Then you can use the PIC and a lookup function to determine how to > set the port outputs. > > You will have to decide how many 'slices' to put in each cycle and > do the conversion at that frequency - many multiples of the desired > output frequency. If the PIC can go that fast! > > Also, search the Microchip site. > --- In , "p.vijayamurugan" > wrote: > > > > hai all > > > > this is vijay from India > > wishing you a happy day > > > > i have a requirement to generate a Sine PWm using PIC 16f877. > > can anybody help me in developing the logic > > thanx in advance > > > > vijay > to unsubscribe, go to http://www.yahoogroups.com and follow the instructions > ------------------------------------------> Yahoo! Groups Links > > a.. To
 You can find some simple solutions to square to sine wave conversions at ...   http://homepage.ntlworld.com/moonshadow/New_Folder/   Click on the Electronics button. Have fun .... John Kent