Quote Originally Posted by HenrikOlsson View Post
Like I said earlier, read the state of channel B at the rising edge of channel A and you have the direction.
i am not quite clear about it, is it something like this ? :

porta =00000001 direction is clockwise
porta =00000010 direction is counter clockwise

what happen with the direction WHILE the encoder is rotating ? wouldn't it be changing constantly ?