I can find direction with this code:

A tied to portb.4
B tied to portb.5

Direction = portb.5 ^ portb.4
lcdout $FE,1,DEC(Direction)


but, the reading is NOT consistent , if I turn clockwise , Direction is not always 1 ( well , most of the time it is 1 ) and vice versa

any tips anyone ?