At 20MHz with a TMR0 prescaler of 1:256 you only have 13mS before TOIF will be set again, and generate the next interrupt.
You're using 500mS delays in main with a 13mS TMR0 interrupt time. Try a delay time shorter than your interrupt time, or save & restore the registers used to hold the delay value, or insert your long delay within the body of the interrupt routine.
You can delay inside the interrupt routine as long as you like before the RETFIE, but I would reload TMR0 with 0 before resetting TOIF.
Bookmarks