|
Re: Project Questions about Programming and Electrical
You could pretty easily use the CCP ports represented by PWMs 13-16 to output single frequency tones. You'd set it up to output a square wave at the particular frequency you want. You'd have to filter it fairly heavily if you wanted a pure tone, of course. Square waves have harmonics at odd multiples of the fundamental frequency, so if it were me, I'd pick what your high frequency is, make yourself something like a 4th or 6th order low pass filter with a corner frequency at that highest frequency. Then you can put out frequencies down to about 1/2 that highest frequency and still have a pretty pure tone. You'd need to make up a separate amp to drive your speaker, and you'd want it to filter out the DC offset inherent in that initial PWM-style square wave and you'd probably need to create a virtual ground split between your 0V and 12V and various other things as well, of course.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.
Lone Star Regional Troubleshooter
|