Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I think there are a number of solutions to your problem. One solution is outlined below. And I think using PICF877 is too much to use for this application You can use Pic16F84A instead.
Solution 1.) Connect you PWM output to RB0 Interrupt pin. As soon as an interrupt occurs during rising edge of the PWM, Reset TMR0 or load proper TMR0 count, and change Interrupt edge definition from rising edge to falling edge. At falling edge of the PWM, get the TMR0 count then multiply to its TMR0 period, you get your PWM pulse width. the problem with this scheme is when TMR0 overflows before falling edge. So you need proper prescaling of the TMR0 so that the overflow period is longer than the PWM width.