Hi, PiKachu

I think reading carefully the '628a datashhet, Chapter CCP, sub chapter CAPTURE could greatly :

1) improve your knowlege
2) show you you're re-inventing the wheel
3) solve your timing headache.

May be your reflected signal input will have to be directed to PortB.3 ... but I do not think it will be an unavoidable problem ...


Now, ... you have a PbP command called RCTime with a 2µs @ 20Mhz resolution ... ( see manual for how it works !!! )

2*1E-6 * 330 = .66 E-3 m ... no comment !
2*65535*1E-6*330 = 43.25 m ... more than your sensors could ever sense !!!


... and remember all period measurements also can be done like that ...

wish you happy hours

Alain