Need help with PIC16F887 PWM output
This is a project in other compiler (MPASM) and other PIC16, but it could help you, note the configuration of the register. The next code is used to control the speed of a motor using a H-bridge, I hope that it works for you:

`   ;use of the CCP module to control motor speed using PWM 
           include p16F877A.inc `

`cntr equ 20
cntr1 equ 21 `


` __CONFIG _RC_OSC &amp; _CP_OFF &amp; _WDT_OFF 
               org 00
             goto start
               org 04
             goto ISR
               org 06
;main program************************************* 
start       bsf STATUS, RP0
            bcf STATUS, RP1 ; select bank 1
            movlw 00
            movwf TRISC 
            movlw B'11111111'
            movwf TRISB
            movwf PR2 ; 255 to PR2
            bcf OPTION_REG, 7 ; active pull-up
            bcf STATUS, RP0 ; select bank 0
            movlw 00
            movwf PORTC
            movlw B'00001100' ; enable PWM
            movwf CCP1CON
            movlw D'128'
            movwf CCPR1 ; 50% duty cycle(motor off)
            bsf T2CON, TMR2ON ; shoot tmr2 without post nor preescale 
            bsf T2CON, T2CKPS1 ; prescaler in 16
            movlw B'10001000' ; INTCON pattern
            movwf INTCON
            goto $
;*************************************************
;SUBROUTINE DELAY*********************************
;*************************************************
delay       movlw D'255'
            movwf cntr
     del1   movlw D'10'
            movwf cntr1
     del    decfsz cntr1
            goto del  
            decfsz cntr
            goto del1
            return
;************************************************`

`;************************************************* 
;INTERRUPT SERVICE ROUTINE************************
;************************************************* 
ISR         btfss PORTB, RB4
            goto incSpeed
            btfss PORTB, RB5
            goto decSpeed
            goto exit`

`incSpeed    movlw D'255'
            xorwf CCPR1, W
            btfsc STATUS, Z ;test increment limit
            goto exit     
            call delay
            movlw D'1'
            addwf CCPR1, F
            btfss PORTB, RB4
            goto incSpeed
            goto exit`

`decSpeed    movlw 0
            xorwf CCPR1, W
            btfsc STATUS, Z ;test decrement limit
            goto exit     
            call delay
            movlw D'1'
            subwf CCPR1, F
            btfss PORTB, RB5
            goto decSpeed
            goto exit`

`exit        bcf INTCON, RBIF
            retfie 
;********************************************  `            
           ` end `


I suggest programming in C compiler

look at the hardw(ISIS PROTEUS):