PURPOSE: To simplify the constitutions of a code display part and a detector, by a method wherein three kinds of codes are arranged in a regularly repeated state by two code element lines and a moving direction is detected by the order of the detected code.
CONSTITUTION: Codes read from detectors 5, 6 are applied to AND gates G11W G13 through AMP1, 2 and, for example, the AND gate G13 comes to "1" while the corresponding flip-flop FF3 is set. In the next step, when one step is advanced, the output of a flip-flop FF2 now comes to "1" while the output of an AND gate G21 comes to "1" and, therefore, an advance pulse is sent to a reversible counter 8 through an OR gate ORA to be counted up. On the other hand, A reset pulse is imparted to a flip-flop FF1 through an OR gate OR1 to reset the flip-flop FF1.