i bet on the internal osc... place the following at the top of your code

OSCCON=%01110000 ' for 8MHZ operation

OR

OSCCON=%01100000 ' for 4MHZ operation