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.
Bookmarks