Orthogonal encoder decoding method based on programmable logic unit, programmable logic unit and MCU controller
By adopting the orthogonal encoder decoding method based on programmable logic units in the MCU, the problem of signal asymmetry and delay in multi-axis robots is solved, and efficient and low-cost encoder decoding is realized, supporting multi-mode switching, and balancing Performance and cost.
Patent Information
- Application Number
- CN202410960077.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-08
AI Technical Summary
When existing MCUs exceed 4 axes in multi-axis robotic applications, they need to add chip or software simulation, resulting in increased costs, signal out-synchronization and processing delays.
Using the orthogonal encoder decoding method based on programmable logic units, the A phase and B phase level signals are obtained through bilateral triggering, converted into pulse signals, and logical operations are performed in the lookup table to output pulse signals to achieve position and circle Number control, supports Z-phase signal input, reducing software processing delay.
It realizes the complete encoder decoding function in a single MCU, ensures signal synchronization, reduces chip costs, supports flexible switching between AB and ABZ modes, balances performance and costs, and reduces the use of programmable logic unit resources.
Smart Images

Figure CN118915529A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the semiconductor field, and in particular to an orthogonal encoder decoding method based on a programmable logic unit, a programmable logic unit and an MCU controller. Background Art
[0002] Quadrature encoders, also known as incremental encoders or photoelectric encoders, are widely used to detect the position and speed of rotary motion systems. Microcontrollers (MCUs) usually use timer modules for counting to read the position information of the encoder. Common MCU products include those from NXP, GigaDevice, and STMicroelectronics. However, this method has some limitations, such as not supporting Z-phase signal input and being unable to correct errors in the AB counting process. Although a dedicated decoding peripheral can implement Z-phase signal input, it will increase system cost as a dedicated peripheral. In addition, whether it is the timer method or the dedicated peripheral method, existing chips usually only support up to 4 encoders, which cannot meet application scenarios such as multi-axis robots that require more encoders.
[0003] For multi-axis robots, each joint requires an encoder. When the number of axes exceeds 4, existing solutions require adding chips or using software simulation, but this increases system costs, and the position signals obtained between chips may be out of sync due to inter-chip communication delays. In addition, software processing increases system overhead, and when multiple encoders act simultaneously, there will be delays in software processing. Summary of the invention
[0004] In view of the shortcomings of the prior art mentioned above, the purpose of the present application is to provide an orthogonal encoder decoding method based on a programmable logic unit, a programmable logic unit and an MCU controller, which are used to solve the problems of increased cost, signal asynchrony and processing delay caused by adding chips or software simulation when the existing encoder solutions for multi-axis robots exceed 4 axes.
[0005] To achieve the above-mentioned purpose and other related purposes, the first aspect of the present application provides an orthogonal encoder decoding method based on a programmable logic unit, which is applied to a programmable logic unit, and the method includes: obtaining an A-phase level signal and a B-phase level signal by double-edge triggering, and converting the A-phase level signal and the B-phase level signal into an A-phase pulse signal and the B-phase pulse signal respectively; inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logical operation, and output a first pulse signal; inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logical operation, and output a second pulse signal; inputting the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into a third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0006] In some embodiments of the first aspect of the present application, the method also includes: inputting the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into a first B channel lookup table, and outputting the first position information; wherein the process of obtaining the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the process of obtaining the second comparison value includes: inputting the AB position information and the second preset position information corresponding to the AB signal of the previous cycle into the second comparator to generate the second comparison value; the first preset position information represents the maximum value of the position information during forward rotation, and the second preset position information represents the minimum value of the position information during reverse rotation; based on the first position information, performing a corresponding position control operation, and outputting the AB position information of the AB signal after the corresponding position control operation is performed; inputting the first comparison value and the second comparison value into the second B channel lookup table, and outputting the first number of turns information; based on the first number of turns information, performing a corresponding number of turns control operation, and outputting the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed.
[0007] In some embodiments of the first aspect of the present application, the method also includes: obtaining a Z-phase level signal and converting the Z-phase level signal into a Z-phase pulse signal; inputting the first pulse signal, the second pulse signal, the Z-phase pulse signal and the third pulse signal of the previous cycle into a fourth A-channel lookup table to output the third pulse signal of the current cycle; inputting the first pulse signal, the second pulse signal, the third pulse signal and the Z-phase pulse signal into a fifth A-channel lookup table to output the fourth pulse signal of the current cycle; inputting the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle into a sixth A-channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle inputted by the orthogonal encoder.
[0008] In some embodiments of the first aspect of the present application, after outputting the third pulse signal and the fourth pulse signal, the following operations are also performed: the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal are input into the first B channel lookup table, and the second position information is output; based on the second position information, a corresponding position control operation is performed, and the ABZ position information of the ABZ signal after the corresponding position control operation is performed is output; the third pulse signal and the fourth pulse signal are input into the second B channel lookup table, and the second number of turns information is output; based on the second number of turns information, a corresponding number of turns control operation is performed, and the ABZ number of turns information of the ABZ signal after the corresponding number of turns control operation is performed is output.
[0009] To achieve the above-mentioned purpose and other related purposes, the second aspect of the present application provides a programmable logic unit, which includes: an AB signal acquisition module: used to acquire an A-phase level signal and a B-phase level signal by double-edge triggering, and convert the A-phase level signal and the B-phase level signal into an A-phase pulse signal and the B-phase pulse signal respectively; input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logic operation, and output a first pulse signal; an AB signal direction decoding module: used to input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logic operation, and output a second pulse signal; input the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into a third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0010] In some embodiments of the second aspect of the present application, the programmable logic unit further includes: an AB signal position decoding module: used to input the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into the first B channel lookup table, and output the first position information; wherein the acquisition process of the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the acquisition process of the second comparison value includes: inputting the AB position information and the second preset position information corresponding to the AB signal of the previous cycle into the second comparator to generate the second comparison value; the first preset position information represents the maximum value of the position information during forward rotation, and the second preset position information represents the minimum value of the position information during reverse rotation; based on the first position information, performing a corresponding position control operation, and outputting the AB position information of the AB signal after the corresponding position control operation is performed; an AB signal number of turns decoding module: used to input the first comparison value and the second comparison value into the second B channel lookup table, and output the first number of turns information; based on the first number of turns information, performing a corresponding number of turns control operation, and outputting the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed.
[0011] In some embodiments of the second aspect of the present application, the programmable logic unit also includes: a Z-phase signal acquisition module: used to acquire a Z-phase level signal and convert the Z-phase level signal into a Z-phase pulse signal; an ABZ signal direction decoding module: used to input the first pulse signal, the second pulse signal, the Z-phase pulse signal and the third pulse signal of the previous cycle into a fourth A-channel lookup table to output a third pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the Z-phase pulse signal into a fifth A-channel lookup table to output a fourth pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle into a sixth A-channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle input by the orthogonal encoder.
[0012] In some embodiments of the second aspect of the present application, the programmable logic unit also includes: an ABZ signal position decoding module: used to input the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal into the first B channel lookup table, and output second position information; based on the second position information, perform a corresponding position control operation, and output the ABZ position information of the ABZ signal after the corresponding position control operation is performed; an ABZ signal number of turns decoding module: used to input the third pulse signal and the fourth pulse signal into the second B channel lookup table, and output second number of turns information; based on the second number of turns information, perform a corresponding number of turns control operation, and output the ABZ number of turns information of the ABZ signal after the corresponding number of turns control operation is performed.
[0013] To achieve the above-mentioned purpose and other related purposes, the third aspect of the present application provides an orthogonal encoder decoding system based on a programmable logic unit, the system comprising an orthogonal encoder and a programmable logic unit, the interaction process of the system comprising: the programmable logic unit obtains the A-phase level signal and the B-phase level signal of the orthogonal encoder by double-edge triggering, and converts the A-phase level signal and the B-phase level signal into an A-phase pulse signal and the B-phase pulse signal respectively; the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal are input into a first A-channel lookup table to perform a logical operation, and a first pulse signal is output; the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal are input into a second A-channel lookup table to perform a logical operation, and a second pulse signal is output; the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle is input into a third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0014] To achieve the above-mentioned purpose and other related purposes, the fourth aspect of the present application provides an MCU controller, including the programmable logic unit as described above.
[0015] As described above, the present application has the following beneficial effects: by implementing the complete encoder decoding function within a single MCU, the synchronization of the position signal is guaranteed, and the software decoding is replaced by a logic circuit, which reduces the overhead and delay. In addition, by providing a four-way decoder and handing over other functions to the programmable logic unit configuration, the chip manufacturing cost is effectively reduced. At the same time, it also supports flexible switching between AB mode and ABZ mode, balancing the contradiction between performance and quantity according to user needs. Finally, by making full use of the characteristics of the programmable logic unit, designing a new lookup table and gate circuit, reducing the occupancy of the programmable logic unit resources, thereby configuring more channels, and achieving a balance between performance, cost and flexibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flow chart of an embodiment of an orthogonal encoder decoding method based on a programmable logic unit of the present application is shown.
[0017] Figure 2 A circuit diagram of decoding direction information based on AB signals in an embodiment of an orthogonal encoder decoding method based on a programmable logic unit of the present application is shown.
[0018] Figure 3a A schematic diagram showing the AB signal and the first lookup table output signal in an embodiment of an orthogonal encoder decoding method based on a programmable logic unit of the present application.
[0019] Figure 3b A schematic diagram showing the AB signal and the first lookup table output signal in another embodiment of the orthogonal encoder decoding method based on a programmable logic unit of the present application.
[0020] Figure 4a A schematic diagram showing the AB signal and the second lookup table output signal in an embodiment of an orthogonal encoder decoding method based on a programmable logic unit of the present application.
[0021] Figure 4b A schematic diagram showing the AB signal and the second lookup table output signal in another embodiment of the orthogonal encoder decoding method based on a programmable logic unit of the present application.
[0022] Figure 5 A circuit diagram of an orthogonal encoder decoding device based on a programmable logic unit in an embodiment of the present application for decoding position information and number of turns information based on AB signals is shown.
[0023] Figure 6 A circuit diagram of decoding direction information based on ABZ signals in an embodiment of an orthogonal encoder decoding terminal based on a programmable logic unit of the present application is shown.
[0024] Figure 7A circuit diagram showing decoding of position information and number of turns information based on ABZ signals in an embodiment of an orthogonal encoder decoding method based on a programmable logic unit of the present application.
[0025] Figure 8 A schematic diagram of the structure of an embodiment of a programmable logic unit of the present application is shown.
[0026] Fig. 9 The schematic diagram of the structure of an embodiment of an orthogonal encoder decoding system based on a programmable logic unit of the present application is shown. DETAILED DESCRIPTION
[0027] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0028] Before further describing the present invention in detail, the nouns and terms involved in the embodiments of the present invention are explained. The nouns and terms involved in the embodiments of the present invention are applicable to the following interpretations:
[0029] <1> Quadrature Encoder: A sensor used to measure mechanical motion that can provide both position and direction of motion information.
[0030] <2> Programmable logic unit: An integrated circuit that contains programmable logic gates, registers, and other logic elements that can be programmed according to user needs to implement specific logic functions.
[0031] <3> Lookup table: A data structure that stores reference relationships. By entering an index value, the corresponding value or data can be found.
[0032] <4> Pulse signal: A short, fast electrical signal generated by an electronic device, usually used for information transmission or control signals.
[0033] <5> Double-edge detection: A signal processing technique that detects both the rising and falling edges of an input signal to determine the signal’s frequency, period, and other parameters.
[0034] To facilitate understanding of the embodiments of the present application, first Figure 1 Detailed description. Figure 1 The flowchart of a method for decoding an orthogonal encoder based on a programmable logic unit in an embodiment of the present invention is shown. The method for decoding an orthogonal encoder based on a programmable logic unit in this embodiment mainly includes the following steps:
[0035] Step S11: acquiring the A-phase level signal and the B-phase level signal by double-edge triggering, and converting the A-phase level signal and the B-phase level signal into the A-phase pulse signal and the B-phase pulse signal respectively.
[0036] In one embodiment of the present invention, an orthogonal encoder decoding method based on a programmable logic unit is applied to the control of robot joint movements, wherein each joint includes an orthogonal encoder. With regard to the encoder signal acquisition problem of a multi-axis robot, when the number of axes exceeds 4, it is usually necessary to add chips to solve the problem. To solve the above problems, the present method can use the PLB (programmable logic unit) peripheral in the HPM6Exx series MCU processor of Pioneer Semiconductor, and design gate circuits to realize the decoding of multi-joint orthogonal encoders, thereby expanding the number of encoders. When the input signal is an AB signal, an 8-way decoder can be expanded, and when the output signal is an ABZ signal, a 4-way decoder can be expanded.
[0037] Furthermore, each programmable logic unit includes 8 A-type channels and 8 B-type channels. When the input signal is an AB signal, one A-type channel and one B-type channel are required for decoding. When the input signal is an ABZ signal, two A-type channels and two B-type channels are required. Among them, the A-type channel is used to perform logic signal processing, and the B-type channel is used to perform counting operations.
[0038] In one embodiment of the present invention, the A-phase level signal and the B-phase level signal are first input to the MCU processor by the orthogonal encoder, and are connected through the IO pins of the MCU processor, and then connected to the programmable logic unit through the interconnection manager peripheral of the MCU processor. Preferably, a filtering mode is configured in the interconnection manager peripheral to filter the input signal of the encoder to remove burrs in the electrical signal on the external circuit board.
[0039] Further, Figure 2 The circuit diagram for decoding direction information based on the AB signal in this embodiment is shown. After obtaining the A-phase level signal and the B-phase level signal, the input A-phase level signal and the B-phase level signal are input to the edge detection module to convert the AB level signal into a pulse signal, wherein both the rising edge and the falling edge of the AB level signal trigger the pulse output, and the pulse width is one clock cycle in the programmable logic unit.
[0040] It is worth noting that this application improves decoding efficiency while reducing the number of channels by utilizing the double-edge triggering method and the hysteresis characteristics of the D flip-flop. Combined with specially designed multiple lookup tables for channels A and B, the decoding process is optimized and the flexibility and accuracy of the system are enhanced. This comprehensive technical application can better handle complex signal environments, improve the accuracy and stability of decoding, and meet more demanding application scenarios. The integration of double-edge triggering, D flip-flops, and lookup tables improves system performance and achieves more efficient signal decoding and processing.
[0041] Step S12: inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logic operation, and outputting a first pulse signal.
[0042] In one embodiment of the present invention, the A-phase level signal, the B-phase level signal, the A-phase pulse signal, and the B-phase pulse signal are input into a first A-channel lookup table to perform a logic operation. Figure 2 As shown, the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal are respectively input into two 4-input 1-output lookup tables chn0.slice0 and chn0.slice1. Among them, the lookup table chn0.slice0 is the first A channel lookup table, and the lookup table chn0.slice1 is the second A channel lookup table below. The outputs of the two lookup tables are the pulse signal when the motor rotates forward and the pulse signal when the motor rotates reversely.
[0043] Figure 3a A schematic diagram of the A-phase level signal, the B-phase level signal, the A-phase pulse signal, the B-phase pulse signal, and the corresponding output signal of the first lookup table (chn0.slice0) and the output signal of the second lookup table (chn0.slice1) in this embodiment is shown.
[0044] Figure 3b It is an enlarged view of the A-phase level signal, the B-phase level signal, the A-phase pulse signal, and the B-phase pulse signal. Figure 3a As shown in the figure, phase B is before phase A, and it is forward rotation at this time. When the level is input, the edge detector sends a pulse signal through the D flip-flop. According to the characteristics of the D flip-flop sequential logic device, it will latch and output the input data only after receiving the clock signal. Therefore, the output of the pulse signal will be delayed, resulting in hysteresis, so the pulse signal obtained by edge detection will lag behind the level signal. Figure 3b As shown, the A-phase pulse signal lags behind the A-phase level signal, and the B-phase pulse signal lags behind the B-phase level signal.
[0045] In one embodiment of the present invention, the first A channel lookup table (lookup table chn0.slice0) shows the input and output of the logic circuit as shown in Table 1. Its input includes the A phase level signal, the B phase level signal, the A phase pulse signal (A pulse) and the B phase pulse signal (B pulse), and the output column represents the output of the lookup table chn0.slice0 corresponding to the input and pulse combination.
[0046] B A B pulse A pulse Out 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0
[0047] Table 1: First A channel lookup table
[0048] Step S13: inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logic operation, and output a second pulse signal.
[0049] Figure 4a A schematic diagram of the A-phase level signal, the B-phase level signal, the A-phase pulse signal, the B-phase pulse signal, and the corresponding output signal of the first lookup table (chn0.slice0) and the output signal of the second lookup table (chn0.slice1) in this embodiment is shown.
[0050] Figure 4b It is an enlarged view of the A-phase level signal, the B-phase level signal, the A-phase pulse signal, and the B-phase pulse signal. Figure 4a , phase A is before phase B, which is inverted. When the level is input, the edge detector sends a pulse signal through the D flip-flop. According to the characteristics of the D flip-flop sequential logic device, it will latch and output the input data only after receiving the clock signal. Therefore, the output of the pulse signal will be delayed, resulting in hysteresis, so the pulse signal obtained by edge detection will lag behind the level signal. Figure 4b As shown, the A-phase pulse signal lags behind the A-phase level signal, and the B-phase pulse signal lags behind the B-phase level signal.
[0051] In one embodiment of the present invention, the second A channel lookup table (lookup table chn0.slice1) has inputs and outputs of the logic circuit as shown in Table 2. Its inputs include the A phase level signal, the B phase level signal, the A phase pulse signal (A pulse) and the B phase pulse signal (B pulse), and the output column represents the output of the lookup table chn0.slice1 corresponding to the input and pulse combination.
[0052] B A Bpulse Apulse Out 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0
[0053] Table 2: Second A channel lookup table
[0054] Step S14: input the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into the third A channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0055] In one embodiment of the present invention, based on the output of the third A channel lookup table corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle, a logical operation is performed by looking up the table in the third A channel lookup table. When the input signal meets the specific conditions in the third A channel lookup table, the output generates a high level, otherwise a low level is generated. Among them, the third A channel lookup table (lookup table chn1.slice0) is shown in Table 3. Among them, the first row represents, from left to right, the output of the third A channel lookup table corresponding to the AB signal of the previous cycle, the second pulse signal and the first pulse signal. When the second pulse signal is a high level 1, it indicates reversal, and when the first pulse signal is a high level 1, it indicates forward rotation, and in the output of the third A channel lookup table, 1 indicates forward rotation and 0 indicates reverse rotation. It can be seen from Table 3 that when the first pulse signal and the second pulse signal are both low levels, the current direction information is consistent with the output of the third A channel lookup table of the previous cycle of the AB signal of the previous cycle. When the first pulse signal and the second pulse signal are different, it indicates forward rotation or reverse rotation. When the first pulse signal and the second pulse signal are both at high level, it indicates that burr interference exists at this time, and the output of the third A channel lookup table of the upper period remains consistent in the level state at this time.
[0056] Among them, the output of the third A channel lookup table corresponding to the AB signal of the previous cycle is realized through the feedback structure of the Memory, so that the output of the third A channel lookup table corresponding to the AB signal of the previous cycle is continuously circulated and accessed internally, thereby realizing the function of storing and accessing data in the same module.
[0057] Out Chn0.Slice1.out Chn0.Slice0.out Out 0 0 0 0 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 1
[0058] Table 3: Third A channel lookup table
[0059] In one embodiment of the present invention, after obtaining the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder, the AB position information is further decoded, and the process includes: inputting the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into the first B channel lookup table, and outputting the first position information; wherein, the process of obtaining the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the process of obtaining the second comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the second preset position information into the second comparator to generate the second comparison value; the first preset position information represents the maximum value of the position information during forward rotation, and the second preset position information represents the minimum value of the position information during reverse rotation; based on the first position information, executing the corresponding position control operation, and outputting the AB position information of the AB signal after the corresponding position control operation is executed.
[0060] Furthermore, after obtaining the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder, the AB number of turns information is further decoded. The process includes: inputting the first comparison value and the second comparison value into the second B channel lookup table, and outputting the first number of turns information; based on the first number of turns information, performing the corresponding number of turns control operation, and outputting the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed.
[0061] In this embodiment, the position and revolution counting functions are performed using a B-type channel. When the rising edge of the first pulse signal (chn0.slice0.out) is received, the position count is increased. When the rising edge of the second pulse signal (chn0.slice1.out) is received, the position count is decreased. Subsequently, the value recorded in the counter is compared with the preset value in the first comparator and the preset value in the second comparator, respectively. If the value recorded in the counter can match the preset value in the first comparator / second comparator, a first comparison value and a second comparison value are generated.
[0062] Furthermore, if Figure 5As shown, the process of decoding the position information of the AB signal includes: inputting the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into the first B channel lookup table to output the first position information. Wherein, the first B channel lookup table (typeb.chn0.clice0) is shown in Table 4. The first row represents the first comparison value, the second comparison value, the second pulse signal and the first pulse signal from left to right. The output represents the first position information obtained by looking up the table. The first position information is input into Counter0 to perform the corresponding position control operation, and the AB position information of the AB signal after the corresponding position control operation is performed is output.
[0063] Exemplarily, the corresponding position control operations represented by the outputs in Table 4 are: 0 indicates that the data unit maintains the value of the previous cycle, 1 indicates that the data unit will set the value of the cmp0 register of this channel to the value of the next cycle, 2 indicates that the data unit will set the value of the cmp1 register of this channel to the value of the next cycle, 4 indicates that the value of the data unit in the next cycle is +1 based on the current value, and 6 indicates that the value of the data unit in the next cycle is -1 based on the current value. By performing the above operations, it can be achieved that when the corresponding information decoded is forward rotation, the operation of position information +1 is performed, and when the corresponding information decoded is reverse rotation, the operation of position information -1 is performed. As shown in Figure 4, when the output of the first comparator is 1, the corresponding output is 2. At this time, the obtained position information is reset from -1 to 399 to achieve zeroing of the number of turns. Through the above-mentioned counting operations of different numbers of turns, the position control operation includes zeroing / counting / setting default value operations of position information.
[0064] Among them, the parameters cmp0 and cmp1 are used to define the configuration range of the encoder. cmp0 represents the lower limit, which is generally 0, and cmp1 represents the upper limit, which is generally 399. For example, for an encoder with 100 lines, a total of 400 different position information is included. At this time, the lower limit represented by cmp0 is configured as 0, and the upper limit represented by cmp1 should be configured as 399, and the calculation formula is 400-1 to ensure that the position information can cover all 400 positions.
[0065] Cmp.operation1 Cmp.operation0 a.chn0.slice1 a.chn0.slice0 Out 0 0 0 0 0 0 0 0 1 4 0 0 1 0 6 0 0 1 1 0 0 1 0 0 2 0 1 0 1 2 0 1 1 0 2 0 1 1 1 2 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0
[0066] Table 4: First B channel lookup table
[0067] Furthermore, if Figure 5As shown, the process of decoding the number of turns information of the AB signal includes: inputting the first comparison value and the second comparison value into the second B channel lookup table, and outputting the first number of turns information; based on the first number of turns information, performing the corresponding number of turns control operation, and outputting the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed. The second B channel lookup table (typeb.chn1.clice1) is shown in Table 5. The signal of the first comparator (cmp.operation0) is a pulse that lasts for one clock cycle when the position value decreases to -1. At this time, the encoder is reversing. The signal will send a logic value of 6 to Counter1, thereby reducing the counter by 1. Similarly, the signal of the second comparator (cmp.operation1) is a pulse that lasts for one clock cycle when the position value increases to 400. This indicates that the encoder is rotating forward, and the signal will send a logic value of 4 to the encoder's Counter, thereby increasing the counter by 1. The number of turns control operation includes counting the number of turns.
[0068] Cmp.operation0 Cmp.operation1 Out 0 0 0 0 1 4 1 0 6 1 1 0
[0069] Table 5: Second B channel lookup table
[0070] In one embodiment of the present invention, when the input signal includes a Z-phase level signal, the process of decoding the direction information includes: obtaining the Z-phase level signal and converting the Z-phase level signal into a Z-phase pulse signal; inputting the first pulse signal, the second pulse signal, the Z-phase pulse signal and the third pulse signal of the previous cycle into the fourth A-channel lookup table to output the third pulse signal of the current cycle; inputting the first pulse signal, the second pulse signal, the third pulse signal and the Z-phase pulse signal into the fifth A-channel lookup table to output the fourth pulse signal of the current cycle; inputting the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle into the sixth A-channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle input by the orthogonal encoder.
[0071] In this embodiment, when a Z-phase level signal is input, the logic circuit for decoding the direction signal is as follows: Figure 6 As shown. Compared with only inputting AB signals, the difference is that in addition to using the first pulse signal, the second pulse signal and the third pulse signal of the previous cycle, the Z-phase pulse signal is also introduced to determine the forward state information, reverse state information and the final direction information of the decoder. Among them, the fourth A channel lookup table (typea.Chn1.slice0) is shown in Table 6. The first row represents from left to right: Z-phase pulse signal, the third pulse signal of the previous cycle, the second pulse signal and the first pulse signal.
[0072] Z pulse Out Chn0.Slice1.out Chn0.Slice0.out Out 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1
[0073] Table 6: Fourth A channel lookup table
[0074] It should be noted that the function of the Z phase signal is to output a pulse every time the encoder rotates one circle, and the original signal has no direction. The above Table 6 (typea.Chn1.slice0) can shield the influence of the Z signal on the output of the direction information and improve the anti-interference ability of the entire system.
[0075] Furthermore, the fifth A channel lookup table (typea.Chn1.slice0) is shown in Table 7, which shows a lookup table for the inversion state when the received signal is an ABZ signal. The first row represents from left to right: a Z phase pulse signal, a third pulse signal, a second pulse signal, and a first pulse signal, and outputs a fourth pulse signal.
[0076] Z pulse TypeA.chn1.slice0.out Chn0.Slice1.out Chn0.Slice0.out Out 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1
[0077] Table 7: Fifth A channel lookup table
[0078] Further, the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle are input into the sixth A channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle input by the orthogonal encoder. The sixth A channel lookup table (Typea.chn1.slice2) is shown in Table 8.
[0079] Z pulse TypeA.chn1.slice0.out Chn0.Slice1.out Chn0.Slice0.out Out 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0
[0080] Table 8: Sixth A channel lookup table
[0081] Furthermore, when the input signal includes a Z-phase level signal, the process of decoding the position information and the number of turns information includes: after outputting the third pulse signal and the fourth pulse signal, the following operations are also performed: the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal are input into the first B channel lookup table, and the second position information is output; based on the second position information, a corresponding position control operation is performed, and the ABZ position information of the ABZ signal after the corresponding position control operation is performed is output; the third pulse signal and the fourth pulse signal are input into the second B channel lookup table, and the second number of turns information is output; based on the second number of turns information, a corresponding number of turns control operation is performed, and the ABZ number of turns information of the ABZ signal after the corresponding number of turns control operation is performed is output.
[0082] Figure 7 The schematic diagram of the process of decoding the position information and the number of turns information contained in the ABZ signal in one embodiment of the present invention is shown. The input is the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal, wherein the third pulse signal and the fourth pulse signal containing the Z phase information are input into the first B channel lookup table (Table 4) and the second B channel lookup table (Table 5) to obtain the second position information and the second number of turns information respectively.
[0083] In the embodiments of the present application, words such as "first" and "second" are used to distinguish the same items or similar items with substantially the same functions and effects. For example, the first lookup table and the second lookup table are only used to distinguish different lookup tables, and their order is not limited. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit them to be different.
[0084] It should be noted that in the embodiments of the present application, words such as "exemplary" or "for example" represent examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0085] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, ab, ac, bc or abc, where a, b, c can be single or multiple.
[0086] Figure 8 is a schematic block diagram of a programmable logic unit provided in an embodiment of the present application. Figure 8 As shown, the programmable logic unit includes an AB signal acquisition module and an AB signal direction decoding module.
[0087] AB signal acquisition module: used for acquiring the A-phase level signal and the B-phase level signal by double-edge triggering, and converting the A-phase level signal and the B-phase level signal into the A-phase pulse signal and the B-phase pulse signal respectively; inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into the first A channel lookup table to perform a logic operation, and outputting a first pulse signal;
[0088] AB signal direction decoding module: used to input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into the second A-channel lookup table to perform logic operations and output a second pulse signal; input the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into the third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0089] In one embodiment of the present invention, the programmable logic unit further includes: an AB signal position decoding module: used to input the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into the first B channel lookup table, and output the first position information; wherein the acquisition process of the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the acquisition process of the second comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the second preset position information into the second comparator to generate the second comparison value; the first preset position information represents the maximum value of the position information during forward rotation, and the second preset position information represents the minimum value of the position information during reverse rotation; based on the first position information, performing the corresponding position control operation, and outputting the AB position information of the AB signal after the corresponding position control operation is performed. AB signal number of turns decoding module: used to input the first comparison value and the second comparison value into the second B channel lookup table, and outputting the first number of turns information; based on the first number of turns information, performing the corresponding number of turns control operation, and outputting the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed.
[0090] In one embodiment of the present invention, when the input signal is an ABZ signal, the programmable logic unit further includes: a Z phase signal acquisition module: used to acquire a Z phase level signal and convert the Z phase level signal into a Z phase pulse signal. An ABZ signal direction decoding module: used to input the first pulse signal, the second pulse signal, the Z phase pulse signal and the third pulse signal of the previous cycle into the fourth A channel lookup table to output the third pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the Z phase pulse signal into the fifth A channel lookup table to output the fourth pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle into the sixth A channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle inputted by the orthogonal encoder.
[0091] Furthermore, the programmable logic unit also includes: an ABZ signal position decoding module: used to input the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal into the first B channel lookup table, and output second position information; based on the second position information, perform a corresponding position control operation, and output the ABZ position information of the ABZ signal after the corresponding position control operation is performed; an ABZ signal number of turns decoding module: used to input the third pulse signal and the fourth pulse signal into the second B channel lookup table, and output second number of turns information; based on the second number of turns information, perform a corresponding number of turns control operation, and output the ABZ number of turns information of the ABZ signal after the corresponding number of turns control operation is performed.
[0092] It should be understood that the specific process of each module executing the above corresponding steps has been described in detail in the above method embodiment, and for the sake of brevity, it will not be repeated here.
[0093] It should also be understood that the division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.
[0094] Fig. 9 is a schematic block diagram of an orthogonal encoder decoding system based on a programmable logic unit provided in an embodiment of the present application. Fig. 9 As shown, the orthogonal encoder decoding system based on a programmable logic unit includes an orthogonal encoder and a programmable logic unit, and the interaction process of the system includes:
[0095] The programmable logic unit obtains the A-phase level signal and the B-phase level signal of the orthogonal encoder by double-edge triggering, and converts the A-phase level signal and the B-phase level signal into the A-phase pulse signal and the B-phase pulse signal respectively; inputs the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logic operation, and outputs a first pulse signal; inputs the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logic operation, and outputs a second pulse signal; inputs the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into a third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
[0096] It should be understood that the specific process of the system executing the above corresponding steps has been described in detail in the above method embodiment, and for the sake of brevity, it will not be repeated here.
[0097] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program and / or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process and / or an execution thread, and a component may be located on a computer and / or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may, for example, communicate through local and / or remote processes according to signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system and / or a network, such as the Internet interacting with other systems through signals).
[0098] Those of ordinary skill in the art will appreciate that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0099] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0100] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0101] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0102] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0103] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0104] In summary, the present application provides an orthogonal encoder decoding method based on a programmable logic unit, a programmable logic unit and an MCU controller. The present invention provides an efficient and flexible orthogonal encoder decoding method, which ensures the synchronization of the position signal by implementing a complete encoder decoding function within a single MCU, and replaces software decoding with a logic circuit to reduce overhead and delay. In addition, by providing a four-way decoder and handing over other functions to the programmable logic unit configuration, the chip manufacturing cost is effectively reduced. At the same time, it also supports flexible switching between AB mode and ABZ mode, balancing the contradiction between performance and quantity according to user needs. Finally, by making full use of the characteristics of the programmable logic unit, designing a new lookup table and gate circuit, reducing the occupancy of programmable logic unit resources, thereby configuring more channels, and achieving a balance between performance, cost and flexibility. Therefore, the present application effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.
[0105] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A decoding method of an orthogonal encoder based on a programmable logic unit, It is characterized in that Applied to a programmable logic unit, the method comprises: Acquire the A-phase level signal and the B-phase level signal by double-edge triggering, and convert the A-phase level signal and the B-phase level signal into an A-phase pulse signal and the B-phase pulse signal respectively; Input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logic operation, and output a first pulse signal; Input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logic operation, and output a second pulse signal; The AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle is input into the third A channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
2. The orthogonal encoder decoding method based on a programmable logic unit according to claim 1, It is characterized in that The method further comprises: The first pulse signal, the second pulse signal, the first comparison value and the second comparison value are input into the first B channel lookup table, and the first position information is output; wherein the process of obtaining the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the process of obtaining the second comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the second preset position information into the second comparator to generate the second comparison value; the first preset position information represents the maximum value of the position information during forward rotation, and the second preset position information represents the minimum value of the position information during reverse rotation; based on the first position information, a corresponding position control operation is performed, and the AB position information of the AB signal after the corresponding position control operation is performed is output; The first comparison value and the second comparison value are input into the second B channel lookup table, and the first number of turns information is output; based on the first number of turns information, a corresponding number of turns control operation is performed, and the AB number of turns information of the AB signal after the corresponding number of turns control operation is performed is output.
3. The orthogonal encoder decoding method based on a programmable logic unit according to claim 1, It is characterized in that The method further comprises: Acquire a Z-phase level signal and convert the Z-phase level signal into a Z-phase pulse signal; Input the first pulse signal, the second pulse signal, the Z-phase pulse signal and the third pulse signal of the previous cycle into the fourth A channel lookup table to output the third pulse signal of the current cycle; Input the first pulse signal, the second pulse signal, the third pulse signal and the Z-phase pulse signal into the fifth A channel lookup table to output the fourth pulse signal of the current cycle; The first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle are input into the sixth A channel lookup table to output the ABZ direction information corresponding to the ABZ signal representing the current cycle of the orthogonal encoder input.
4. The orthogonal encoder decoding method based on a programmable logic unit according to claim 3, It is characterized in that After outputting the third pulse signal and the fourth pulse signal, the following operation is further performed: Input the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal into a first B channel lookup table, and output second position information; Based on the second position information, a corresponding position control operation is performed, and ABZ position information of the ABZ signal after the corresponding position control operation is performed is output; The third pulse signal and the fourth pulse signal are input into the second B channel lookup table, and the second number of turns information is output; based on the second number of turns information, the corresponding number of turns control operation is performed, and the ABZ number of turns information of the ABZ signal after the corresponding number of turns control operation is performed is output.
5. A programmable logic unit, It is characterized in that The programmable logic unit comprises: AB signal acquisition module: used for acquiring the A-phase level signal and the B-phase level signal by double-edge triggering, and converting the A-phase level signal and the B-phase level signal into the A-phase pulse signal and the B-phase pulse signal respectively; inputting the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into the first A channel lookup table to perform a logic operation, and outputting a first pulse signal; AB signal direction decoding module: used to input the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into the second A-channel lookup table to perform logic operations and output a second pulse signal; input the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into the third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
6. The orthogonal encoder decoding system based on programmable logic unit according to claim 5, It is characterized in that The programmable logic unit also includes: AB signal position decoding module: used for inputting the first pulse signal, the second pulse signal, the first comparison value and the second comparison value into the first B channel lookup table, and outputting the first position information; wherein, the process of obtaining the first comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the first preset position information into the first comparator to generate the first comparison value; the process of obtaining the second comparison value includes: inputting the AB position information corresponding to the AB signal of the previous cycle and the second preset position information into the second comparator to generate the second comparison value; the first preset position information indicates the maximum value of the position information during forward rotation, and the second preset position information indicates the minimum value of the position information during reverse rotation; based on the first position information, executing the corresponding position control operation, and outputting the AB position information of the AB signal after executing the corresponding position control operation; AB signal turn number decoding module: used to input the first comparison value and the second comparison value into the second B channel lookup table, and output the first turn number information; based on the first turn number information, perform the corresponding turn number control operation, and output the AB turn number information of the AB signal after the corresponding turn number control operation is performed.
7. The orthogonal encoder decoding system based on programmable logic unit according to claim 5, It is characterized in that The programmable logic unit also includes: Z phase signal acquisition module: used for acquiring the Z phase level signal and converting the Z phase level signal into a Z phase pulse signal; ABZ signal direction decoding module: used to input the first pulse signal, the second pulse signal, the Z-phase pulse signal and the third pulse signal of the previous cycle into the fourth A-channel lookup table to output the third pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the Z-phase pulse signal into the fifth A-channel lookup table to output the fourth pulse signal of the current cycle; input the first pulse signal, the second pulse signal, the third pulse signal and the ABZ direction information corresponding to the previous cycle into the sixth A-channel lookup table to output the ABZ direction information corresponding to the ABZ signal of the current cycle input by the orthogonal encoder.
8. The orthogonal encoder decoding system based on programmable logic unit according to claim 7, It is characterized in that The programmable logic unit also includes: ABZ signal position decoding module: used for inputting the first pulse signal, the second pulse signal, the third pulse signal and the fourth pulse signal into the first B channel lookup table, and outputting second position information; based on the second position information, performing a corresponding position control operation, and outputting the ABZ position information of the ABZ signal after performing the corresponding position control operation; ABZ signal revolution decoding module: used to input the third pulse signal and the fourth pulse signal into the second B channel lookup table, and output the second revolution information; based on the second revolution information, perform the corresponding revolution control operation, and output the ABZ revolution information of the ABZ signal after the corresponding revolution control operation is performed.
9. An orthogonal encoder decoding system based on a programmable logic unit, It is characterized in that The system includes an orthogonal encoder and a programmable logic unit, and the interaction process of the system includes: The programmable logic unit obtains the A-phase level signal and the B-phase level signal of the orthogonal encoder by double-edge triggering, and converts the A-phase level signal and the B-phase level signal into the A-phase pulse signal and the B-phase pulse signal respectively; inputs the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a first A-channel lookup table to perform a logic operation, and outputs a first pulse signal; inputs the A-phase level signal, the B-phase level signal, the A-phase pulse signal and the B-phase pulse signal into a second A-channel lookup table to perform a logic operation, and outputs a second pulse signal; inputs the AB direction information corresponding to the first pulse signal, the second pulse signal and the AB signal of the previous cycle into a third A-channel lookup table to output the AB direction information corresponding to the AB signal of the current cycle input by the orthogonal encoder.
10. An MCU controller, It is characterized in that The method comprises a programmable logic unit as claimed in any one of claims 5 to 8.
