init
clrf CCP1CON ; Clear CCP Control register to reset CCP module
movlw b'001011[COLOR="Red"]00[/COLOR]' ; control word to switch CCP module to PWM mode (and period LSB's)
; b:7-6 = not used
; b:5-4 = LSB duty cycle
; b:3-0 = CCP module configuration 11xx = PWM mode
movwf CCP1CON
bsf status,rp0 ; access bank 1
movlw .25 ; Set duty cycle
movwf PR2
bcf status,rp0 ; return to bank 0
movlw [COLOR="red"].12[/COLOR] ; set period of PWM
movwf CCPR1L
bcf CCP1CON,5 ; set bit 1
bcf CCP1CON,4 ; set bit 0
movlw b'0000[COLOR="red"]0[/COLOR]110' ; Turn on TMR2 and set post scaler to 1 and prescaler to 4
; b:7 = not used
; b:6-4 = post scale 0000 = 1:1
; b:3 = 1 TMR2 ON
; b:2-1= 10 prescale = 1:4
movwf T2CON
retlw 0