# AN: Expanded Ultra Fast Magic Sinewave Calculator

T

#### Tim Williams

Jan 1, 1970
0
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
register.

Tim

D

#### Don Lancaster

Jan 1, 1970
0
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
register.

Tim

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...

<http://www.tinaja.com/magsna1.asp>

"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

Please visit my GURU's LAIR web site at http://www.tinaja.com

Replies
3
Views
1K
A
Replies
11
Views
3K
Rich Grise
R
N
Replies
0
Views
966
Neil Fisk
N
L
Replies
2
Views
1K
D
Replies
3
Views
702