Yes, I understand that, questiton is, how do you represent that using a single pin ? Jan-Erik. PS. And I think you should have read the rest of the thread before replying... DS. Tal wrote: There are two sensors in a slight angular shift. They are designed such that there is overlap between there pulses. When you rotate the wheel in one direction you get A B 0 0 0 1 1 1 1 0 0 0 And when in the other direction you get this sequence reversed. A simple finite state machine is used to extract from these sequences Increment and Decrement pulses. The finite state machine is designed such that even if the wheels changes direction arbitrarily, you don't accomulate any error. Tal -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.