An encoder, comprising: an encoder main body configured to measure a displacement magnitude of a measured object, the encoder main body including - a displacement magnitude detection portion configured to measure a displacement magnitude of the measured object and - a rotation detection portion configured to count a number of rotations of the measured object, the rotation detection portion including - a magnetic detection portion configured to detect a magnetic change in a magnetic rotating body and - an optical detection portion configured to detect a slit in an encoding plate, the optical detection portion being shared with an optical detection portion of the displacement magnitude detection portion and - a signal processing clock circuit adapted to generate clock signals and - a direction discrimination pulse generating circuit adapted to process signals of the magnetic detection portion and the optical detection portion to generate signals (UP1, DOWN1) indicative of the number and the direction of rotations, wherein the direction discrimination pulse generating circuit determines the rotational direction and the necessity of a count and being adapted to process the signals of the magnetic detection portion and the optical detection portion synchronized with the clock signals. an encoder main body configured to measure a displacement magnitude of a measured object, the encoder main body including - a displacement magnitude detection portion configured to measure a displacement magnitude of the measured object and - a rotation detection portion configured to count a number of rotations of the measured object, the rotation detection portion including - a magnetic detection portion configured to detect a magnetic change in a magnetic rotating body and - an optical detection portion configured to detect a slit in an encoding plate, the optical detection portion being shared with an optical detection portion of the displacement magnitude detection portion and - a signal processing clock circuit adapted to generate clock signals and - a direction discrimination pulse generating circuit adapted to process signals of the magnetic detection portion and the optical detection portion to generate signals (UP1, DOWN1) indicative of the number and the direction of rotations, wherein the direction discrimination pulse generating circuit determines the rotational direction and the necessity of a count and being adapted to process the signals of the magnetic detection portion and the optical detection portion synchronized with the clock signals. - a displacement magnitude detection portion configured to measure a displacement magnitude of the measured object and - a rotation detection portion configured to count a number of rotations of the measured object, the rotation detection portion including - a magnetic detection portion configured to detect a magnetic change in a magnetic rotating body and - an optical detection portion configured to detect a slit in an encoding plate, the optical detection portion being shared with an optical detection portion of the displacement magnitude detection portion and - a magnetic detection portion configured to detect a magnetic change in a magnetic rotating body and - an optical detection portion configured to detect a slit in an encoding plate, the optical detection portion being shared with an optical detection portion of the displacement magnitude detection portion and - a signal processing clock circuit adapted to generate clock signals and - a direction discrimination pulse generating circuit adapted to process signals of the magnetic detection portion and the optical detection portion to generate signals (UP1, DOWN1) indicative of the number and the direction of rotations, wherein the direction discrimination pulse generating circuit determines the rotational direction and the necessity of a count and being adapted to process the signals of the magnetic detection portion and the optical detection portion synchronized with the clock signals.