On Fri, 18 May 2001, James Newton wrote: > Bloody fascinating Scott... Isn't it fun contorting square waves! > > ...killed an hour and a half on that one page and I still don't really have > it, although I've got a sort of an "almost there" sort of buzz... > > ...could be just brain cells burning out... > > ...now where did I put those aspirin... > > If I got all that correctly, in practical terms, "Magic" sinewaves are > better when you are switching lots of power (like a motor driver or power > amp) and PWM is better when power efficiency is less important but you DO > need: > A) lower uP clock speed and code complexity or > B) higher output frequencies or > C) more even variations in amplitude such as when you need > D) summation of multiple frequencies to one output (digital mixing). > > Is that right? > > Has anyone made a motor driver that uses "Magic" sinewaves? Mike Keitz made one. Where's Mike? There are some practical problems with Magic Sinewaves. On a pic at least, they can only be implemented in software. This requires isochronous code. There are (at least) two ways to implement them in a pic. One is to put the MS into a ROM table, the other is to encode the MS directly in instruction delays. The look up table requires ~10-15 cycles per edge, while the direct encoding only requires 3 (or one if you're really twisted and demented - 1). I suppose a co-routine solution would be appropriate too. Another problem, or perhaps side effect, is that since the patterns are hard coded, there is less amplitude variability/control. Also, it's more difficult to control the generated frequency. I suppose you could add vriable dely in the looup table, but the quantization effects would cause large frequency jumps. (BTW, a better way to control the frequency is to PLL the RC oscillator on a PIC - something else Mike has done). Scott -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body