Ok ...

This is code obviously coming straight from a BS2 !!!

1) you must tell PbP you work @ 20 Mhz ...

DEFINE OSC 20 ... and use HS Oscillator

2) as your channels follow each other, you must know you'll measure CH1, miss CH2, miss CH1, measure CH2, measure CH1, miss CH2, miss CH1 , measure CH2, etc, etc ...

not very critical but you must know it for your timings ...


3) Think CH1 and CH2 are refreshed every 20 - 25 ms ... and you'll have to update your captures ... so what do forward1,reverse1,ccw and cc subs must not take too long a time, to allow updating your channels at a "decent" rate ...

4) may be you will have to add wrong pulses detection ... but it is another story !!!

Alain