> -----Original Message----- > From: Kieren Johnstone [SMTP:misterfugit@HOTMAIL.COM] > Sent: Friday, August 09, 2002 10:32 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: [PIC]: Best frequency synthesis method > > Surely if TMR0 overflows at 19.5 KHz, by switching a PWM every time I > could > get 9.7 KHz, every 256 interrupts I could get about 76 Hz; in the original > post I mentioned 4.9 KHz being the highest note I'd consider.. > > -Kieren > I think you and Olin are talking at cross purposes. I *think* you wish to produce tones using square waves only, which is acheivable in software. However PWM does not come into the equation, what you would require in this case is something called DDS (direct digital synthesis) to produce a wide range of frequencies using a timer overflow etc. This is where the confusiuon is arrising. With PWM, you are generating an average DC voltage from a higher frequency variable duty cycle rectangular wave. From this you can produce any arbitrary analog signal, but the maximum frequency and resolution of this signal is determined by the frequency of your PWM, which is why Olin (correctly) stated you would not be able to achive 8 bit resolution with a reasonable frequency range in software . I'm guessing you are happy making notes with fixed amplitude square waves, much like the ringtones from (most) mobile phones etc. PWM would give you the flexibility to play back notes at different amplitudes and with different voices, using samples stored in memory. Regards Mike -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads