Hi,
Here's what had worked for me. Richard is right, you cant use HPWM for frequencies above 32.768khz.
Set the registers as follows.
TRISC.2 = 0 ' CCP1 (PortC.2 = Output)
PR2 = 25 ' Set PWM Period for approximately 38KHz
CCPR1L = 13 ' Set PWM Duty-Cycle to 50%
CCP1CON = %00001100 ' Mode select = PWM
T2CON = %00000100 ' Timer2 ON + 1:1 prescale
This would give you a continuous 38khz on the pwm pin, at 50% duty cycle.
Now, toggle TRISC.2 between an input and an output at 1ms.
Hope it works! If it does, thanks go to Bruce Reynolds. If doesnt, brickbats to me!
Regards.
Bookmarks