I'm planning to measure the duty-cycle of a square wave with interrupts: RB0INT for the signal and TIMER0 for timing. Considering one period, the PIC starts counting after the rising edge; then I fave to change the INTEDG bit; the PIC stops counting after the falling edge; this is Ton. After getting Toff in a similar way, the duty cicle will be calculated and displayed on an LCD.
Is this a valid method? Any alternatives?
Thanks
You might try studying the code for the many frequency counters, these measure frequency at high frequencies and switch to pulse width measuring at low frequencies.