I've had some luck using the capture function of the CCP module.
Set up an interrupt (or just poll the CCP1 flag) and alternate between setting CCP1CON=$04 and CCP1CON=$05 to capture TMR1 to CCPR1H:CCPR1L on falling and rising edges, respectively. As TMR1 runs, you can save as many transitions as memory allows. (You may be able to use just the highbyte, depending on the resolution you need.)
To transmit the recorded signal, set up as compare mode CCP1CON=$0A and toggle the output on and off.




Bookmarks