Have you considered using DT INTERRUPTS for the timing?

Have you considered using the PORT ON CHANGE feature to detect high-low and low-high? (check datasheet, you don't mention which PIC you are using).

Robert