I am attempting to use the 10 bit PWM facility on the PIC18F452. Following guidance in the data sheet I have written this code:

'Program to test use of PWM out PortC.2 (Pin 17, CCP1) on 18F452
'Does not work yet!

Include "modedefs.bas"
define LOADER_USED 1 'Bootloader
define OSC 20 'Sets clock to 20MHz


PR2=%11111111 'Set PWM period. Gives 1220.7Hz (0.82ms) with 20MHz clock
CCPR1L=%11110000 'Set PWM duty cycle in CCPR1L register
CCP1CON.4=0: CCP1CON.5=0 'Set PWM duty cycle in CCP1CON<5:4> bits (total of 0.2ms)
TRISC.2=0 'Make CCP1 pin an output
T2CON.0=0: T2CON.1=1 'Set TMR2 prescale value
T2CON.2=1 'Enable Timer2
CCP1CON.0=0: CCP1CON.1=0
CCP1CON.2=1: CCP1CON.3=1 'Configure the CCP1 module for PWM operation


Loop:

goto loop

End


However ... no luck!

Any suggestions?