The rotary encoder is composed of a photoelectric code disk with a shaft in the center, on which there are circular and dark engraved lines, and is read by photoelectric transmitting and receiving devices to obtain four groups of sine wave signals combined into A, B, C, D, Each sine wave has a phase difference of 90 degrees, and the C and D signals are reversed and superimposed on the A and B phases to enhance the stable signal; in addition, each revolution outputs a Z-phase pulse to represent the zero reference position.