because you already set the output of RC2 to PWM mode at the beginning, so you will see it sometime is on and sometime is off. i think is your main broad got problem, design problem. you should fully understand how your motor driver circuit function and which pin you are chosing. Direct copy without understand is not a process of study.
since you are using the 20Mhz crystal, so in calculation the time will different. the duty cycle and the period is most important part in PWM. If setting is wrong, your motor ofcause cannot function and control speed.