;*** Outputting a 10 KHz, 40% duty cycle PWM square wave on pin RC2/CCP1
;*** count for 10kHz = 249
;*** 40% duty cycle count = 100

MOVLW   250             ;1.  Load 10 kHz frequency count
MOVWF   PR2
MOVLW   100             ;2.  Load Duty cycle count
MOVWF   CCPR1L  
MOVLW   0
MOVWF   CCPR1H
BCF     TRISC,CCP1      ;3.  Set pin RC2 for output
MOVLW   B'00000100'     ;4.  Set prescale to 1 and enable Timer2
MOVWF   T2CON
MOVLW   B'00001100'     ;5.  Enable PWM and set to PWM mode
MOVWF   CCP1CON