Changing PIC clock speed

ccdubs

Member
Hi All,

I want to generate a 1kHz continuous output with an 18X on pin 3. In the past when I have done this I have used the pwmout command and a poke $8f, %01000000 command to slow the clock speed so I can acheive the correct frequency.

Now I would like to add other tones which are better generated with the sound command. However I don't want these to be affected by the reduced clock speed.

Is there any complication if I change the processor speed of the PIC on the fly everytime that tone is needed and then change it back?

Or perhaps there is a better way to acheive this tone? ( I have asked that question on this forum previously and the answer was to use the above method.)

Thanks.
 

hippy

Technical Support
Staff member
There shouldn't be any problem switching back to normal speed. Use SETFREQ M4 or SETFREQ M8 as required as that will ensure the clock has stabilised before continuing.
 
Top