Hello,

This is my first post and I am trying to get the 18F25K22 to generate 2 MHz PWM 50% duty cycle on CCP1 (pin 12). I have followed the seven steps in the datasheet on page 186 by setting the appropriate registers with no output at all. My hardware is a 16MHz crystal and DEFINE OSC = 64 MHz using 4xPLL. I know it is capable of generating 2 MHz because the PicAxe 28x2 (a 18F25K22) does when driven with 64 MHz. I am using the register setup method because the PBP manual says the maximum HPWM frequency at any osc speed is 32,767Hz

Here is the register setup that I am using:

TRISC = %00000010 ' Set PWM bit 1 for input during setup
CCPTMRS0 = %0000000 ' Set CCP1 to use Timer2
PR2 = %00000111 ' Set Timer2 coumter to 7
CCP1CON = %00101100 ' Set to PWM mode and 2 LSB bits of duty cycle
CCPR1L = %00001100 ' Set MSB of duty cycle
T2CON = %01000101 ' Set Prescaler to 1 & turn on PWM
TRISC = %00000000 ' Set PWM bit for output to enable PWM

I am using PBP 3.06 and the weird thing is that can't get the HPWM command to output anything either with just 20Khz.

I have just started working with the 18F25K22 the last couple of days so I might be missing something dumb, please let know.

Thanks,

-Tim