Art,
I have working boards already designed using the 10F222, which I chose because of the small pin count and because the 10F322 could be used in its place (Except PBP does not support the 322). I am using AN0 (pin1) as an analog input to select the tone. GP1 for output (pin3), and GP2 as the trigger (pin4). If I can stick with the 10F222 and PBP I would, but I don’t see how I can. It is only running at 4MHz. I don’t think there is a timer on this chip that can do what I need. There is a T0CKI on the pin I am using as the trigger (input). I could cut traces and swap the trigger and speaker output pins easy enough if there was a way to use T0CKI to generate the tones. I wouldn’t know how to do this though.

Jim


Quote Originally Posted by Art View Post
Hi,
If you changed to a chip that has hardware PWM and PBP supports it, you might as well go back to PBP.
If it is not supported, and you must use C (which I never would for an 8 bit pic), the code to set PWM will look more or less the same.

http://www.micro-examples.com/public...alculator.html

At the above site, choose an audio frequency that you will hear through your speaker,
your oscillator frequency, and might as well start with 50% duty cycle, and it will spit out register settings for the frequency,
and tell you the error for your selected frequency.
Your pic’s registers will probably be exactly the same because the calc is assuming an 8 bit pic.

PBP SOUND is a blocking command which is has to be, or the command would never return to execute any other code,
but all it does is toggle a pin which could be done with a hardware timer, or a number of other ways.