Have a look at the PWM Mode section, 9.3The data sheet isn't clear on what are the maximum values or if only specific frequencies are allowed.
PWM Period = [(PR2)+1] * 4 * Tosc * TMR2prescale
PWM Freq = 1 / PWM period
So, your frequency can be varied over a wide range. With a 20 MHz OSC, Min = 1.221 KHz, Max = 2.5 MHz.
As Tobias suggested, use Mister-E's Calculator to help with getting the correct value for PR2 and TRM2 Prescale.
http://www.picbasic.co.uk/forum/showthread.php?t=4994
Some examples with 20 MHz OSC:
02 KHz - PR2=155, Prescaler 1:16
05 KHz - PR2=249, Prescaler 1:4
10 KHz - PR2=124, Prescaler 1:4
20 KHz - PR2=249, Prescaler 1:1
Bookmarks