Ok, Well that was copied from the datasheet, Anyways I have this code that works perfectly on the PIC16F628A and has the same setup (Registers and order of Configuration) as the PIC16F877A, and it doesnt work on the 877a... It is really confusing me... I think my OSCILLOSCOPE needs more tubes though because it acts weird when testing the Square waves so I just hooked an LED on it and still doesnt work... So basically the 628a works but the 877a doesnt with the same code...
When seting CCPR1L and CCP1CON(bits 4,5) to control the PWM duty cycle for testing purposes forget about CCP1CON(bits 4,5). i.e. leave them at 0. Now use only CCPR1L to change the duty cycle. You will now only have a single 8-bit register to adjust but you loose granularity. Example: if you set CCPR1L: 0, 1, 2, 3... the corresponding 10-bit value for the duty cycle will be 0, 4, 8, 16...