Hi,

1) @20Mhz ... min Pauseus is ... 3µs !!!

2) UNTIL NOT PortA.5 is much quicker than UNTIL PortA.5 = 0

3) PortF.6 = 1 is much quicker than HIGH PortF.6

4) Instead of Repeat - Until NOT PortA.5, try While PortA.5 - Wend ...

Alain