I haven't checked your code, but, from the description, I think you need to look at it differently to get the correct results. Try it this way.
enable comparator1 and 2 interrupts
when comparator1 interrupts,
clear timer1
clear timer2
start timer1 and timer 2 running
when comparator1 interrupts again, do the following....
stop timer1 running & store the 'count' (this gives a clock pulse 'count' for the arriving frequency, but since I'm only after phase shift...which is a time based measurement, I don't calculate the frequency)
when comparator2 interrupts, stop timer2 & store the count
Bookmarks