Ignoring the fact that you are looking for a very fast frequency... you shouldn't be setting the timer values in the interrupt*... just let the hardware do it for you... i.e. overflow and keep the comparison fixed.
According to..
http://eng-serve.com/pic/pic_timer.html//Timer1 Registers Prescaler= 1 - TMR1 Preset = 65508 - Freq = 178571.43 Hz - Period = 0.000006 seconds
T1CON.T1CKPS1 = 0; // bits 5-4 Prescaler Rate Select bits
T1CON.T1CKPS0 = 0; // bit 4
T1CON.T1OSCEN = 1; // bit 3 Timer1 Oscillator Enable Control bit 1 = on
T1CON.T1SYNC = 1; // bit 2 Timer1 External Clock Input Synchronization Control bit...1 = Do not synchronize external clock input
T1CON.TMR1CS = 0; // bit 1 Timer1 Clock Source Select bit...0 = Internal clock (FOSC/4)
T1CON.TMR1ON = 1; // bit 0 enables timer
TMR1H = 255; // preset for timer1 MSB register
TMR1L = 228; // preset for timer1 LSB register
Should get you 178571.43 Hz... now there isn't much going on apart from the interrupt so your interrupt runs flat out... if it doesn't have much overhead (saving and restoring registers etc) it might be able to keep up.
Now coming back to the original question...
https://www.micro-examples.com//public/microex-navig/doc/097-pwm-calculator.html might help for PWM modes...
/*
* PWM registers configuration
* Fosc = 20000000 Hz
* Fpwm = 178571.43 Hz (Requested : 180000 Hz)
* Duty Cycle = 50 %
* Resolution is 6 bits
* Prescaler is 4
* Ensure that your PWM pin is configured as digital output
* see more details on
http://www.micro-examples.com/ * this source code is provided 'as is',
* use it at your own risks
*/
PR2 = 0b00000110 ;
T2CON = 0b00000101 ;
CCPR1L = 0b00000011 ;
CCP1CON = 0b00011100 ;
Footnote
* I looked at a few examples on the interweb and they have set_timer1 in the ISR... this is an antipattern to me as the interval will end up being affected by the ISR service time (and ISR jitter due to other interrupts)... go figure... what do I know.
