Google on "magic sine waves" and then let your jaw flop to the ground. This is sort of what you are proposing. -- Lawrence Lile Senior Project Engineer Toastmaster, Inc. Division of Salton, Inc. 573-446-5661 voice 573-446-5676 fax Koen van Leeuwen Sent by: pic microcontroller discussion list 01/07/2004 02:30 PM Please respond to pic microcontroller discussion list To: PICLIST@MITVMA.MIT.EDU cc: Subject: Re: [PIC:] Frequency dividing to 440 Hz That still limits me to a square wave though. It would be nice to have some time for some d/a conversion that would lead to a lower THD. (less parts, more complex software = cheaper and more fun for a hobbyist) Anybody built an d/a convertor out of the USART and and integrator before or am I the first (I mean, with a PIC. I know SACD works roughly this way)? The idea: 1 = curve goes up 0 = curve goes down Tied to an integrator with virtual ground at Vdd/2 this would give the curve back. So a sine would look like 111011010101001000000100101010110111 and loop (draw it if you don't see it) As you can see this is quite small, and can be compressed much more: a sine is pointsymmetrical(?) so you can mirror halfway, and invert a quarter. So you only have to store a quarter of a period, one byte would lead to 32 samples/period. I haven't been able to calculate the harmonic distortion, but its surely more smooth than a square wave :o) But I guess I have to open up my filter design book... oh wait thats a next quarter course... :o) Greetings, Koen -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads