In modern industrial control systems, control of the motor is an important part of it. The encoder acts as a detector for the angular displacement of the motor and provides an important feedback signal to the system. This paper introduces a DSP and FPGA-based HEIDENHAIN optical encoder signal processing universal module suitable for embedded systems. It can measure and process HEIDENHAIN high-precision incremental encoder signals and absolute use of EnDat2.2 bidirectional digital interface. Encoder signal. The module is suitable for different numbers of digits and different types of HEIDENHAIN encoders. The module can work effectively and quickly through experiments, debugging and testing, and has been applied to the experimental turntable. With the rapid development of science and technology, the application of automatic control systems in various fields has become more and more, especially the computer automatic control system has become an indispensable part of modern science and technology, military engineering and modern industry. Thus, automatic control elements such as various motors as power plants, generators, and various control motors as signal conversions are widely used in various control systems. To control the controlled object, not only the controller and the actuator, but also the feedback device. Therefore, the encoder has been widely used as a detecting device for the angle, speed and direction of the motor. The encoder has a resolver, a Hall sensor and a photoelectric encoder. Among them, the photoelectric encoder has high precision, strong anti-interference ability, simple interface and convenient use, thus obtaining the most extensive application [1]. The photoelectric encoder mainly has two types of incremental encoder and absolute encoder. The former has the advantages of high resolution, low price and simple interface. However, in today's industry, there is no power-down memory function. It has a great limitation on its application; the latter is compact in structure, small in size, digital in interface, strong in anti-interference ability, and has power-down memory function, which is also paid more and more attention in applications [2]. In the current market, Germany's HEIDENHAIN has a wide range of products and has a good quality guarantee. It is widely used in machine tools and automation, especially in the semiconductor and electronics manufacturing industries. HEIDENHAIN optical encoders have a large market share, and the matching decoding devices are not suitable for embedded system applications. In this paper, an incremental and absolute universal data processing module is designed for the HEIDENHAIN encoder used in the experimental turntable. The module has the advantages of fast signal processing speed, high precision, accurate data, flexible application, convenient use and debugging, low cost, etc., which can well meet the needs of use. The incremental encoder converts the displacement into a periodic electrical signal through a grating, and then converts the electrical signal into a counting pulse, and the number of pulses represents the magnitude of the displacement. The grating consists of periodic reticle lines, and the position information is obtained by calculating the number of increments (measurement steps) from a certain point. The high-precision HEIDENHAIN incremental encoder to be measured by this module also has a track engraved with a distance-coded reference point to speed up the reference point return [3]. Figure 1 below shows a circular grating with distance encoding. Figure 1 Circular grating with distance-coded reference point (ERA4480) These reference points are at a distance from each other determined by a mathematical algorithm. After two pulses of three reference points have passed, the subsequent electronics can find the absolute reference point. The absolute encoder photoelectrically converts the physical reticle on the code wheel by using natural binary, cyclic binary (Gray code) or PRC code, converts the rotation angle of the connecting shaft into a corresponding electric pulse sequence and outputs it in digital form. Each location corresponds to a certain unique digital code and thus has a power-down memory function [4]. Sometimes digital drive systems and feedback loops that obtain position values ​​via position encoders also require the encoder to provide some additional value. In order to make the system more reliable, the encoder also needs to have error detection and diagnosis. The Endat 2.2 data interface from HEIDENHAIN is a bidirectional data interface for encoders that can transmit the position values ​​of absolute or incremental encoders, as well as transmit or update information stored in the encoder or save new ones. information. It only requires 4 lines due to serial data transmission. The data transmission remains synchronized with the subsequent electronic device clock signal. The type of data transmitted (position value, parameter or diagnostic information, etc.) is selected by the mode command sent to the encoder by the subsequent electronic device [5]. This module uses a combination of DSP and FPGA. DSP is mainly used in the field of digital signal processing, and is very suitable for high-density, repetitive computing and signal processing of large data capacity. On the one hand, FPGA/CPLD devices can realize parallel operation on hardware, which is very suitable for real-time measurement and control and high-speed applications. On the other hand, the physical mechanism is as reliable as pure hardware circuits, especially for strong electromagnetic interference. The combination of the two can achieve wideband signal processing with fast speed and good reliability [6]. According to the functional requirements of the scheme, the structure diagram of the design module is shown in Figure 2: Figure 2 hardware structure diagram In the figure, the module connector is a standard DB15 connector. Through the pin configuration, the signal can be communicated with the incremental encoder and the absolute encoder with EnDat2.2 interface. The transceiver unit of the module supports the RS-485 form, and the differential signal and the single-ended signal are converted by the interface chip. In order to improve the data measurement accuracy of the high-precision incremental encoder, four readheads are installed on the same incremental encoder, and the incremental encoder data is measured separately, and then the position value is synthesized. Thus, there are four interfaces for reading the encoder signals on the board. The FPGA chip uses the XC3S700An of the Xilinx Spartan-3AN series, and the logic cells are 10476. Realization: 1 count of incremental signal and acquisition of reference signal, after counting data reaching the reference code channel, clearing the incremental signal; 2 collecting the position signal of Endat2.2 absolute encoder; 3 outside Before the rising edge of the synchronous clock arrives, the count processing is saved, and the data is stored in the dual-port RAM, waiting for the DSP to read. The DSP chip selected for this module is TI's TMS320F28335, with a frequency of up to 150MHz. TMS320F28335 adds a floating-point arithmetic unit, which saves the code execution time and storage space while maintaining the advantages of the original DSP chip such as powerful control and signal processing capability, C language programming efficiency, etc. [7]. The F28335 is connected to the XC3S700An via a GPIO port with four address lines and 16 data lines. It can accept 16 encoder signals. The DSP part of the module opens up the parameter storage area, reads the data in the FPGA when the interrupt signal arrives, completes the data synthesis, and sends the data to the main control chassis through the SCI serial port, and the electrical form is RS422. The module board is powered by a 5V power supply. Square Hole Breadboard,400 Tie Point Breadboard,Makeronics Breadboard,Small Solderless Breadboard Cixi Zhongyi Electronics Factory , https://www.cx-zhongyi.com