6n137 in the figure has the function of optocoupler isolation, and the photoelectric encoder connects its output to the QEP end of DSP through optocoupler isolation. The rotation direction and relative angular displacement are obtained by the output pulse source and pulse count of the incremental encoder. If the number of gratings of the code disk is assumed to be represented by N, the resolution of rotation speed is 1 / n. In order to ensure a higher speed measurement accuracy, the speed detection part of the incremental photoelectric encoder designed in this paper selects 16384 pulses per revolution. The accuracy of motor speed detection directly affects the accuracy of hoist speed control system. The principle of grating speed measurement is to calculate the motor speed by counting the number of pulses output by the photoelectric encoder within a certain sampling time.