Re: generate sin wave with PWM



Jerry Avins wrote:

Paul E. Bennett wrote:
ivan wrote:

hi all,

How do I generate a sin wave using PWM?
The way I have thought is just to create a triangular wave with equal
steps of the PWM duty cycle (depending on freq) and then filter out the
harmonics with a hw filter.
But what if I want to generate a sin wave instead of a triangular wave,
how do I calculate the steps for the duty cycle of the PWM? These steps
are not equal, so I will need to store them in a table.
Any ideas?

Others will tell you of all sorts of formulae and about look-up tables
but one technique that many forget is called a "Digital Differential
Analyser". With some very simple maths and some logic these can be
implemented and produce sine and cosine streams of data which could be
used more-or-less directly by the PWM generation logic.

Put the term "Digital Differential Analyser" and Sizer into Google's
search string and you will get a number of references that may prove
useful (especially if you register for the IEEE and CiteSeer sites.

Paul,

I have long felt that we shared a common way of seeing things. Did you
see my response?

Only after I had posted and on my subsequent trawl through the newsgroups.

--
********************************************************************
Paul E. Bennett ....................<email://peb@xxxxxxxxxxxxxxxxxx>
Forth based HIDECS Consultancy .....<http://www.amleth.demon.co.uk/>
Mob: +44 (0)7811-639972
Tel: +44 (0)1235-811095
Going Forth Safely ..... EBA. www.electric-boat-association.org.uk..
********************************************************************
.



Relevant Pages

  • Re: generate sin wave with PWM
    ... How do I generate a sin wave using PWM? ... But what if I want to generate a sin wave instead of a triangular wave, ... "The rights of the best of men are secured only as the ...
    (comp.arch.embedded)
  • Re: High frequency PWM generation
    ... clock the maximum frequency of PWM I can generate is ~31Khz at 8 bit ... Are there any external PWM generator ICs which I can use ... Also If I want to sin modulate the PWM with sin wave of 4khz then is ... There are some other AVRs which has PLLs onchip. ...
    (comp.arch.embedded)
  • Re: High frequency PWM generation
    ... clock the maximum frequency of PWM I can generate is ~31Khz at 8 bit ... Are there any external PWM generator ICs which I can use ... Also If I want to sin modulate the PWM with sin wave of 4khz then is ...
    (comp.arch.embedded)
  • High frequency PWM generation
    ... clock the maximum frequency of PWM I can generate is ~31Khz at 8 bit ... Are there any external PWM generator ICs which I can use ... Also If I want to sin modulate the PWM with sin wave of 4khz then is ...
    (comp.arch.embedded)
  • Pulse-Width modulation
    ... My waveforms are ... 2.Carrier wave - Triangular wave 40v peak to peak. ... i have to implement pwm using It. ...
    (sci.electronics.design)