Connect with us

AN: Expanded Ultra Fast Magic Sinewave Calculator

Discussion in 'Electronic Design' started by Don Lancaster, May 14, 2010.

Scroll to continue with content
  1. Tim Williams

    Tim Williams Guest

    Hey Don, have you ever played with generating PWM from arbitrary length
    counters? i.e., instead of setting TOP = 4096 for 12 bit accuracy, vary TOP
    and COMPARE so you get a ratio of two numbers instead of one fixed.
    Especially if combined with dithering (maybe driven with Bresenham's
    algorithm or delta-sigma), this will give higher accuracy for a given
    bandwidth/clock rate. The central problem is finding the ratio, which is
    simply the largest convergent (continued fraction) that fits in the


  2. We originally started magic sinewaves with exhaustive searches, similar
    to the above.

    Turns out there are quite a few 384 bit words!
    Several, even.

    All sorts of weird and slow games eventually converged on our latest (
    and near instant! ) calculators. And then Chrome made them even faster.

    Curiously, I still have found no way to rapidly calculate plain old
    Magic Sinewaves. Turns out there is some redundancy ( such as 8
    equations in 6 unknowns ) that it is not obvious how to deal with.

    The original ms calculations can still be done using the "series II"
    portion of this ancient code...


    "regular" magic sinewaves have the curious property that their first
    unwanted harmonics are OPPOSITE IN SIGN and (nearly) comparable in
    amplitude to BBE bridged best efficiency ones.

    Sadly, all attempts at mixing them for cancellation to date have
    worked but introduced cosine terms or subharmonics that mostly do
    a lot more harm than good.

    "Too good to be true" strikes again.

    Many thanks,

    Don Lancaster voice phone: (928)428-4073
    Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
    rss: email:

    Please visit my GURU's LAIR web site at
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day