Encoder speed measuring circuit and method and encoder system

Through the synchronous counting technology in the encoder speed measurement circuit, the speed of the rotating shaft is obtained by using the comparator and timer, which solves the problem that the absolute encoder cannot accurately calculate the speed, and achieves high-precision speed measurement.

CN120446524APending Publication Date: 2025-08-08GEEHY SEMICON CO LTD
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202510483975.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing absolute value encoder only outputs position information and does not have speed information, resulting in errors in the speed calculation of the rotating shaft and low position reading accuracy.

Method used

Through the encoder speed measurement circuit, the synchronous counting is performed based on the pulse signal of the comparator through at least two comparators, the first timer and the second timer, ensuring that the second timer starts counting at the correct moment, and combining the processor to calculate the rotation speed of the rotating shaft.

Benefits of technology

It improves the speed measurement accuracy of the encoder, realizes accurate measurement of the rotational axis speed, and reduces position reading errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120446524A_ABST
    Figure CN120446524A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an encoder speed measurement circuit, an encoder speed measurement method and an encoder system. The circuit comprises at least two comparators, a first timer, a second timer and a processor, the first end of each comparator is used for being connected with the encoder, the second end of each comparator is connected with the first end of the first timer, the second end of the first timer is connected with the first end of the second timer, and the third end of the first timer and the second end of the second timer are connected with the processor; the comparator is used for converting the received analog signal into a pulse signal and sending the pulse signal to the first timer; the first timer is used for counting according to the pulse signal of the comparator and triggering the second timer to synchronously time in the counting process; the processor is used for obtaining the rotating speed of the rotating shaft according to the first count value output by the first timer and the second count value output by the second timer. The second timer is ensured to start counting at a correct moment, and accurate measurement of the rotating speed of the rotating shaft is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to, in particular to, an encoder speed measurement circuit, method and encoder system. Background Art

[0002] Motion control systems rely on four key parameters: position, speed, acceleration, and torque. Absolute encoders, as position sensors, provide important position feedback information for motion control systems.

[0003] The existing absolute encoder only outputs position information, no speed information. The speed of the existing motion control system is generally calculated by reading the encoder position information at regular intervals: by reading the two positions before and after the Tx time and Calculate the speed To accurately calculate speed, an absolute encoder must continuously calculate position at a fixed time interval Tx. To ensure accurate position information for the motion control system, the absolute encoder begins calculating position only upon receiving a read position command from the motion control system. While the absolute encoder is calculating position within the fixed time interval Tx, if the motion control system issues a read position command during this period, the encoder may not have completed the current position calculation. The position data returned to the control system may be the result of the previous cycle, rather than the real-time position at the time the command was sent.

[0004] Therefore, in the prior art, due to the working mechanism of the encoder and the timing of data reading, there are errors in the position reading accuracy, which will lead to errors in the calculation of the rotation speed of the rotating shaft. Summary of the Invention

[0005] The embodiments of the present application provide an encoder speed measurement circuit, method and encoder system to improve the speed measurement accuracy of the encoder and achieve the effect of accurately measuring the rotational speed.

[0006] In a first aspect, an embodiment of the present application provides an encoder speed measurement circuit, comprising: at least two comparators, a first timer, a second timer, and a processor;

[0007] A first end of each comparator is connected to the encoder, a second end of each comparator is connected to a first end of a first timer, a second end of the first timer is connected to a first end of a second timer, and a third end of the first timer and a second end of the second timer are connected to the processor;

[0008] The comparator is used to convert the received analog signal into a pulse signal and send it to the first timer; the analog signal is used to represent the rotation position of the rotating shaft detected by the encoder;

[0009] The first timer is used to count according to the pulse signal of the comparator and trigger the second timer to count synchronously during the counting process;

[0010] The processor is used to obtain the rotation speed of the rotating shaft according to the first count value output by the first timer and the second count value output by the second timer; wherein the first count value is used to represent the number of rotations of the rotating shaft; and the second count value is used to represent the rotation time of the rotating shaft.

[0011] In one embodiment, the first timer includes an edge trigger unit, a first terminal of the edge trigger unit is connected to the comparator, and a second terminal of the edge trigger unit is connected to the second timer;

[0012] The edge trigger unit is used to detect the pulse signal and generate a trigger signal when the pulse signal changes. The trigger signal is used to control the second timer to start synchronous timing.

[0013] In one embodiment, the first timer includes an orthogonal decoding unit and a first counting unit;

[0014] The first end of the orthogonal decoding unit is connected to the comparator, the second end of the orthogonal decoding unit is connected to the first counting unit, and the orthogonal decoding unit is used to perform orthogonal counting on the pulse signal;

[0015] The first end of the first counting unit is connected to the orthogonal decoding unit, the second end of the first counting unit is connected to the second timer, the third end of the first counting unit is the first output end of the first timer, and the third end of the first counting unit is connected to the processor; the first counting unit is used to receive the timing signal sent when the second timer starts timing, and after receiving the timing signal, starts counting according to the output result of the orthogonal decoding unit, and outputs the first counting value to the processor.

[0016] In one embodiment, the second timer includes a second counting unit and a comparing unit;

[0017] A first end of the second counting unit is connected to the first timer, a second end of the second counting unit is connected to the first input end of the comparison unit, a third end of the second counting unit is connected to the first counting unit, and a fourth end of the second counting unit is connected to the processor; the third end of the second counting unit is used to output a timing signal, and the second end of the second counting unit is used to output a second count value to the processor;

[0018] The second input end of the comparison unit is used to receive a preset time, and the output end of the comparison unit is connected to the processor; the comparison unit is used to output a calculation signal when the second count value is equal to the preset time; the calculation signal is used to control the processor to obtain the rotation speed of the rotating shaft according to the first count value and the second count value.

[0019] In one embodiment, the orthogonal decoding unit is further configured to detect a rotation direction of the rotating shaft, and when the rotation direction of the rotating shaft changes, generate a reset signal and send the reset signal to the first counting unit and the second counting unit;

[0020] The reset signal is used to control the first counting unit and the second counting unit to restart counting.

[0021] In one embodiment, the second timer further includes a register unit, a first end of the register unit is connected to the second counting unit, a second end of the register unit is connected to the first timer, and is configured to receive a trigger signal and store the second count value according to the trigger signal;

[0022] The third terminal of the register unit is connected to the processor and is used to send the second count value to the processor.

[0023] In one embodiment, the circuit further comprises a speed register, a first terminal of the speed register is connected to the processor, and a second terminal of the speed register is connected to the second counting unit;

[0024] The speed register is used to store the rotation speed of the rotating shaft calculated by the processor and send a speed measurement completion signal to the second counting unit; the speed measurement completion signal is used to control the second counting unit to start timing.

[0025] In one embodiment, the circuit further includes a controller, and the second timer further includes a frequency dividing unit; a first terminal of the controller is connected to the third terminal of the speed register, a second terminal of the controller is connected to the first terminal of the frequency dividing unit, and a second terminal of the frequency dividing unit is connected to the second counting unit;

[0026] The controller is used to receive the rotation speed of the rotating shaft and set the frequency division coefficient according to the rotation speed of the rotating shaft;

[0027] The frequency division unit is used to receive a frequency division coefficient; the frequency division coefficient is used to adjust the counting frequency of the second timer.

[0028] In one embodiment, the controller is further connected to the comparison unit, and the controller is configured to adjust a preset time of the comparison unit according to the rotation speed of the rotating shaft to improve the calculation efficiency of the rotation speed of the rotating shaft.

[0029] In a second aspect, an embodiment of the present application provides an encoder speed measurement method, which is applied to any of the above-mentioned encoder speed measurement circuits, and the method includes:

[0030] The first timer obtains a first count value according to the pulse signal; the first timer outputs a trigger signal according to the pulse signal; the first count value is used to represent the number of rotations of the rotating shaft;

[0031] The second timer receives the trigger signal and starts synchronous timing according to the trigger signal, and outputs a second count value after the timing is completed; the second count value is used to represent the rotation time of the rotating shaft;

[0032] The processor obtains the rotation speed of the rotating shaft according to a first count value output by the first timer and a second count value output by the second timer.

[0033] In one embodiment, the method further comprises:

[0034] The processor stores the rotation speed of the rotating shaft in a speed register;

[0035] The speed register sends the rotational speed of the rotating shaft to the controller;

[0036] The controller receives the rotation speed of the rotating shaft and adjusts the frequency division coefficient and the preset time according to the rotation speed of the rotating shaft;

[0037] The second timer adjusts the second count value according to the frequency division coefficient and the preset time.

[0038] In a third aspect, an embodiment of the present application provides an encoder system, comprising any of the above-mentioned encoder speed measurement circuits.

[0039] The encoder speed measurement circuit, method, and encoder system provided by the embodiments of the present application include: at least two comparators, a first timer, a second timer, and a processor; the first end of each comparator is connected to the encoder, the second end of each comparator is connected to the first end of the first timer, the second end of the first timer is connected to the first end of the second timer, and the third end of the first timer and the second end of the second timer are connected to the processor; the comparator is used to convert a received analog signal into a pulse signal and send it to the first timer; the analog signal is used to represent the rotational position of the rotating shaft detected by the encoder; the first timer is used to count according to the pulse signal of the comparator and trigger the second timer to count synchronously during the counting process; the processor is used to obtain the rotational speed of the rotating shaft based on the first count value output by the first timer and the second count value output by the second timer; wherein the first count value is used to represent the number of rotations of the rotating shaft; and the second count value is used to represent the rotation duration of the rotating shaft. The first timer and the second timer count simultaneously based on the pulse signal of the comparator, ensuring that the second timer starts counting at the correct time, achieving accurate measurement of the rotational speed of the rotating shaft and improving the speed measurement accuracy of the encoder. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] Figure 1A schematic diagram of the structure of an encoder speed measurement circuit provided in one embodiment of the present application;

[0042] Figure 2 A schematic diagram of converting an analog signal into a pulse signal according to an embodiment of the present application;

[0043] Figure 3 A schematic diagram of an analog signal output by an encoder according to an embodiment of the present application;

[0044] Figure 4 A schematic structural diagram of an encoder speed measurement circuit provided in another embodiment of the present application;

[0045] Figure 5 This is a flowchart of an encoder speed measurement method provided in one embodiment of the present application.

[0046] The above drawings illustrate specific embodiments of the present application, which will be described in more detail below. These drawings and the textual description are not intended to limit the scope of the present application in any way, but rather to illustrate the concepts of the present application to those skilled in the art by reference to specific embodiments. DETAILED DESCRIPTION

[0047] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0048] The operation of a motion control system is inseparable from the four key parameters of position, speed, acceleration, and torque. As a position sensor, an absolute encoder provides important position feedback information for the motion control system. Existing absolute encoders only output position information, not speed information. In the prior art, the speed of the rotating shaft is calculated by reading the two positions before and after the Tx time. and Calculate the speed Accurate speed calculation requires an absolute encoder to continuously calculate position at a fixed time interval (Tx). If the controller sends a position read command, the encoder may not have yet completed the current position calculation. The position data returned to the control system may be the result of the previous cycle, rather than the real-time position at the time the command was sent. This inaccurate position reading can lead to errors in the calculated rotational speed of the rotating shaft.

[0049] The encoder speed measurement circuit provided in the present application simultaneously counts the pulse signal output by the comparator through the first timer and the second timer, ensuring that the second timer starts counting at the correct time, improving the position reading accuracy of the first timer, realizing accurate measurement of the rotating shaft speed, and improving the speed measurement accuracy of the encoder.

[0050] The following specific embodiments describe in detail the technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0051] like Figure 1 As shown, Figure 1 A schematic diagram of the structure of an encoder speed measurement circuit provided in one embodiment of the present application. The encoder speed measurement circuit includes: at least two comparators, a first timer, a second timer, and a processor; the first end of each comparator is used to connect to the encoder, the second end of each comparator is connected to the first end of the first timer, the second end of the first timer is connected to the first end of the second timer, and the third end of the first timer and the second end of the second timer are both connected to the processor; the comparator is used to convert a received analog signal into a pulse signal and send it to the first timer; the analog signal is used to represent the rotation position of the rotating shaft detected by the encoder; the first timer is used to count according to the pulse signal of the comparator and trigger the second timer to synchronously count during the counting process; the processor is used to obtain the rotation speed of the rotating shaft based on the first count value output by the first timer and the second count value output by the second timer; wherein the first count value is used to represent the number of rotations of the rotating shaft; and the second count value is used to represent the rotation duration of the rotating shaft.

[0052] The present application synchronizes timing through a first timer and a second timer based on a pulse signal converted by a comparator. The first timer obtains the number of rotations of the rotating shaft, and the second timer obtains the rotation duration. The processor obtains the rotation speed of the rotating shaft based on the first count value output by the first timer and the second count value output by the second timer, ensuring that the second timer starts counting at the correct time, improving the position reading accuracy of the first timer, realizing accurate measurement of the rotation speed of the rotating shaft, and improving the speed measurement accuracy of the encoder; secondly, the two comparators process analog signals in parallel, converting the analog signals into pulse signals, thereby improving the acquisition speed and efficiency; the design of two timers, one responsible for counting and the other for timing, ensures that the processing of pulse signals is not limited to the capabilities of a single timer.

[0053] In one embodiment, the processor generates a first count value N output by the first timer. T1 and the second count value N output by the second timer T2, calculate the speed register value n0=N T1 / N T2 The unit of speed is generally rpm (revolutions per minute). The final speed n of the rotating shaft is calculated as follows:

[0054] Formula (1)

[0055] Set n0=N T1 / N T2 Substituting into formula (1) yields the following formula:

[0056] Formula (2)

[0057] in, Indicates the number of revolutions made by the second timer from the start of counting at 0 to the preset time; fm indicates the main frequency in Hz; αdiv indicates the timer 2 frequency division coefficient; Indicates that the second timer starts counting from 0 to a preset time in minutes. Optionally, the processor is a divider.

[0058] Comparator 1 and Comparator 2 are responsible for converting the sine / cosine signals into pulse signals. The sine and cosine signals generated inside the absolute encoder exist in single-ended mode and differential mode. Figure 2 As shown, Figure 2 A schematic diagram of converting an analog signal into a pulse signal according to an embodiment of the present application. Figure 2 Figure (a) shows the case where the sine and cosine signals are in single-ended mode. The sine or cosine signal is input to the positive terminal of the comparator, and the DC bias voltage Vb of the sine or cosine signal is input to the negative terminal of the comparator. The external DC bias voltage Vb needs to be provided based on the actual sine / cosine situation. Figure 2 Figure (b) shows the case where the sine and cosine signals are in differential mode. The positive end of the sine or cosine signal is input to the positive end of the comparator, and the negative end of the sine or cosine signal is input to the negative end of the comparator.

[0059] In one embodiment, Figure 3 As shown, Figure 3 This is a schematic diagram of an analog signal output by an encoder provided in one embodiment of the present application. The analog signal is a sine signal or a cosine signal. The absolute value encoder rotates at a constant speed for one revolution, generating 1 to N cycles of sine / cosine signals internally.

[0060] In one embodiment, Figure 4 As shown, Figure 4This is a schematic diagram of the structure of an encoder speed measurement circuit provided in another embodiment of the present application. The first timer includes an edge trigger unit, a first end of which is connected to a comparator, and a second end of which is connected to a second timer. The edge trigger unit is used to detect a pulse signal and generate a trigger signal when the pulse signal changes. The trigger signal is used to control the second timer to start synchronous timing.

[0061] Specifically, the edge trigger unit can detect edge changes in the comparator's output pulse signal in real time. This means it can respond to changes in the input signal at any time and trigger corresponding events. This fast response time prevents subsequent timing and counting tasks from being delayed. The first timer can quickly react to signal changes and generate a trigger signal. Based on this trigger signal, the second timer can start timing at the correct moment, thus achieving parallel processing. The design of the edge trigger unit enables the encoder to independently measure speed without relying on read commands from an external system, thereby improving response speed and accuracy.

[0062] In one embodiment, see Figure 4 The first timer includes an orthogonal decoding unit and a first counting unit; the first end of the orthogonal decoding unit is connected to the comparator, the second end of the orthogonal decoding unit is connected to the first counting unit, and the orthogonal decoding unit is used to perform orthogonal counting on the pulse signal; the first end of the first counting unit is connected to the orthogonal decoding unit, the second end of the first counting unit is connected to the second timer, the third end of the first counting unit is the first output end of the first timer, and the third end of the first counting unit is connected to the processor; the first counting unit is used to receive a timing signal sent when the second timer starts timing, and after receiving the timing signal, starts counting according to the output result of the orthogonal decoding unit, and outputs a first counting value to the processor.

[0063] Specifically, the direction of rotation of the rotating shaft changes: If the shaft rotates clockwise, assuming that during clockwise rotation, the order of changes for signals A and B is: A rising edge - B rising edge - A falling edge - B falling edge. In this case, the first timer will detect the rising edge of signal A followed by the rising edge of signal B, indicating a clockwise rotation. If the rotation direction changes to counterclockwise, the order of changes for signals A and B becomes: B rising edge - A rising edge - B falling edge - A falling edge. Now, the first timer will first detect the rising edge of signal B, followed by the rising edge of signal A, which is the opposite of the clockwise order. Therefore, by detecting the order of changes for signals A and B, the first timer can determine whether the shaft's rotation direction has changed. When the first timer detects a change from clockwise to counterclockwise (or vice versa), it can determine that the rotation direction has reversed.

[0064] The quadrature decoding unit typically outputs two square wave signals with a 90-degree phase difference, commonly referred to as phase A and phase B. The first counting unit counts clockwise: When phase A rises, it checks the state of phase B. If phase B is low, the counter increments by 1 (indicating clockwise rotation). If phase B is high, the counter decrements by 1 (indicating counterclockwise rotation). When phase B rises, it checks the state of phase A. If phase A is high, the counter increments by 1 (indicating clockwise rotation). If phase A is low, the counter decrements by 1 (indicating counterclockwise rotation).

[0065] In one embodiment, see Figure 4 The second timer includes a second counting unit and a comparing unit; the first end of the second counting unit is connected to the first timer, the second end of the second counting unit is connected to the first input end of the comparing unit, the third end of the second counting unit is connected to the first counting unit, and the fourth end of the second counting unit is connected to the processor; the third end of the second counting unit is used to output a timing signal, and the second end of the second counting unit is used to output a second counting value to the processor; the second input end of the comparing unit is used to receive a preset time, and the output end of the comparing unit is connected to the processor; the comparing unit is used to output a calculation signal when the second counting value is equal to the preset time; the calculation signal is used to control the processor to obtain the rotational speed of the rotating shaft according to the first counting value and the second counting value.

[0066] Specifically, when the second count value counted by the second timer equals a preset time, a calculation signal is output, activating a processor, which then calculates the rotational speed of the rotating shaft based on the first count value and the second count value. The processor is independent and does not count the first and second timers, ensuring that the first and second count values are obtained in real time and accurately.

[0067] In one embodiment, the orthogonal decoding unit is also used to detect the rotation direction of the rotating shaft. When the rotation direction of the rotating shaft changes, a reset signal is generated and sent to the first counting unit and the second counting unit; the reset signal is used to control the first counting unit and the second counting unit to recount.

[0068] Specifically, if the first timer detects a change in the pulse signal, which means that the rotation direction of the rotating shaft has changed, for example, the rotating shaft rotates from clockwise to counterclockwise, the first counting unit and the second counting unit need to re-count.

[0069] In one embodiment, see Figure 4 The second timer also includes a storage unit, a first end of the storage unit is connected to the second counting unit, and a second end of the storage unit is connected to the first timer, for receiving a trigger signal and storing a second count value according to the trigger signal; a third end of the storage unit is connected to the processor, for sending the second count value to the processor.

[0070] Specifically, upon receiving a trigger signal, the register unit stores the second count value of the second counting unit, that is, stores the second count value when the second timer starts timing. When the processor receives a calculation signal, the second count value equals the preset time, and the register unit sends the second count value to the processor. At this time, the trigger signal received by the register unit is cleared.

[0071] In one embodiment, see Figure 4 The circuit also includes a speed register, a first end of the speed register is connected to the processor, and a second end of the speed register is connected to the second counting unit; the speed register is used to store the rotation speed of the rotating shaft calculated by the processor and send a speed measurement completion signal to the second counting unit; the speed measurement completion signal is used to control the second counting unit to start timing.

[0072] Specifically, the speed value calculated by the processor is stored in a speed register for easy subsequent reading and use. The existence of the speed register allows the system to quickly access the current speed information without having to recalculate it each time, thereby improving overall efficiency. Secondly, the speed register sends a speed measurement completion signal to the second counting unit. Upon receiving the speed measurement completion signal, the second counting unit begins counting, avoiding repeated counting if the previous speed measurement has not yet completed.

[0073] In one embodiment, see Figure 4 The circuit also includes a controller, and the second timer also includes a frequency division unit; the first end of the controller is connected to the third end of the speed register, the second end of the controller is connected to the first end of the frequency division unit, and the second end of the frequency division unit is connected to the second counting unit; the controller is used to receive the rotational speed of the rotating shaft and set the frequency division coefficient according to the rotational speed of the rotating shaft; the frequency division unit is used to receive the frequency division coefficient; the frequency division coefficient is used to adjust the counting frequency of the second timer.

[0074] Specifically, the frequency division factor adapts to different time scales: the main frequency (fm) is often very high, such as several megahertz (MHz) or even higher. Directly counting at such a high frequency may cause the timer to overflow very quickly, especially when measuring longer time intervals. The frequency division factor reduces the counting frequency, allowing the timer to adapt to longer time scales. This is very useful for measuring slower events or longer time intervals. In some cases, directly using a high frequency may cause the counter to overflow in a short period of time, thereby limiting the accuracy and range of the measurement. By using frequency division, the counting range and accuracy can be flexibly adjusted without changing the hardware design. Therefore, the accuracy of the second count value can be improved by adjusting the frequency division factor.

[0075] In one embodiment, the controller is further connected to the comparison unit, and the controller is configured to adjust a preset time of the comparison unit according to the rotation speed of the rotating shaft to improve the calculation efficiency of the rotation speed of the rotating shaft.

[0076] Specifically, when the encoder operates within a narrow speed range (a few revolutions per minute), the preset time of the comparison unit can be set to a shorter value to facilitate more frequent sampling and calculations. The frequency division coefficient of the frequency division unit can be appropriately increased to reduce unnecessary calculations, thereby lowering power consumption. When the encoder operates within a higher speed range (tens of revolutions per minute, or even hundreds of revolutions per minute), the preset time of the comparison unit can be set to a longer value to reduce the system's computational burden. A smaller frequency division coefficient can be selected, allowing the timer to more accurately capture changes in the pulse signal, thereby improving the accuracy of speed calculations. The controller can dynamically adjust the preset time and frequency division coefficient of the second timer's comparison unit as needed, allowing the speed measurement circuit to quickly adapt to changes within different speed ranges without stopping for reconfiguration, thereby improving overall processing efficiency.

[0077] In one embodiment, the controller may further adjust the preset time and the frequency division coefficient of the comparison unit according to the rotation speed of the rotating shaft and the target rotation speed.

[0078] Specifically, if the rotation speed of the rotating shaft differs greatly from the target rotation speed, the controller may adjust the preset time and the frequency division coefficient of the comparison unit to further optimize the speed measurement accuracy.

[0079] The embodiment of the present application provides an encoder speed measurement method, which is applied to any of the above-mentioned encoder speed measurement circuits. The method includes the following steps: Figure 5 As shown, Figure 5 A flowchart of an encoder speed measurement method provided in one embodiment of the present application:

[0080] Step S501: The first timer obtains a first count value according to a pulse signal; the first timer outputs a trigger signal according to the pulse signal; the first count value is used to represent the number of rotations of the rotating shaft.

[0081] Step S502: The second timer receives a trigger signal and starts synchronous timing according to the trigger signal, and outputs a second count value after the timing is completed; the second count value is used to represent the rotation duration of the rotating shaft.

[0082] Step S503: The processor obtains the rotation speed of the rotating shaft according to the first count value output by the first timer and the second count value output by the second timer.

[0083] In one embodiment, the method further comprises the following steps:

[0084] The processor stores the rotation speed of the rotating shaft in a speed register.

[0085] The speed register sends the rotational speed of the rotating shaft to the controller.

[0086] The controller receives the rotation speed of the rotating shaft and adjusts the frequency division coefficient and the preset time according to the rotation speed of the rotating shaft.

[0087] The second timer adjusts the second count value according to the frequency division coefficient and the preset time.

[0088] An embodiment of the present application provides an encoder system, comprising any of the above-mentioned encoder speed measurement circuits.

[0089] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASICs), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the present invention may be directly executed by a hardware processor or by a combination of hardware and software modules within the processor.

[0090] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage.

[0091] A bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Buses can be categorized as address buses, data buses, and control buses. For ease of illustration, the buses in the drawings of this application are not limited to just one bus or just one type of bus.

[0092] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0093] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0094] The readable storage medium may be implemented by any type of volatile or non-volatile memory device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium may be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0095] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0096] The division of units is merely a logical functional division; actual implementations may employ alternative divisions, such as combining or integrating multiple units or components into another system, or omitting or disabling certain features. Furthermore, any direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units, either through an interface, electrical, mechanical, or other means.

[0097] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0098] In addition, each functional unit in each embodiment of the present invention 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.

[0099] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the method of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical disks.

[0100] Those skilled in the art will appreciate that all or part of the steps in the above-described method embodiments can be implemented using hardware associated with program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0101] Finally, it should be noted that those skilled in the art will readily identify other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses, or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art not disclosed herein. The present invention is not limited to the precise structure described above and illustrated in the accompanying drawings, and various modifications and variations may be made without departing from the scope thereof. The scope of the present invention is limited solely by the appended claims.

Claims

1. An encoder speed measurement circuit, characterized in that: include: at least two comparators, a first timer, a second timer, and a processor; The first end of each comparator is used to connect to the encoder, the second end of each comparator is connected to the first end of the first timer, the second end of the first timer is connected to the first end of the second timer, and the third end of the first timer and the second end of the second timer are both connected to the processor; The comparator is used to convert the received analog signal into a pulse signal and send it to the first timer; the analog signal is used to represent the rotation position of the rotating shaft detected by the encoder; The first timer is used to count according to the pulse signal of the comparator and trigger the second timer to synchronously count during the counting process; The processor is used to obtain the rotational speed of the rotating shaft based on the first count value output by the first timer and the second count value output by the second timer; wherein the first count value is used to represent the number of rotations of the rotating shaft; and the second count value is used to represent the rotation duration of the rotating shaft.

2. The circuit according to claim 1, wherein: The first timer includes an edge trigger unit, a first end of the edge trigger unit is connected to the comparator, and a second end of the edge trigger unit is connected to the second timer; The edge trigger unit is used to detect the pulse signal and generate a trigger signal when the pulse signal changes. The trigger signal is used to control the second timer to start synchronous timing.

3. The circuit according to claim 1, wherein: The first timer includes an orthogonal decoding unit and a first counting unit; A first end of the orthogonal decoding unit is connected to the comparator, a second end of the orthogonal decoding unit is connected to the first counting unit, and the orthogonal decoding unit is used to perform orthogonal counting on the pulse signal; The first end of the first counting unit is connected to the orthogonal decoding unit, the second end of the first counting unit is connected to the second timer, the third end of the first counting unit is the first output end of the first timer, and the third end of the first counting unit is connected to the processor; the first counting unit is used to receive a timing signal issued when the second timer starts timing, and after receiving the timing signal, starts counting according to the output result of the orthogonal decoding unit, and outputs the first counting value to the processor.

4. The circuit according to claim 3, characterized in that The second timer includes a second counting unit and a comparing unit; A first end of the second counting unit is connected to the first timer, a second end of the second counting unit is connected to the first input end of the comparison unit, a third end of the second counting unit is connected to the first counting unit, and a fourth end of the second counting unit is connected to the processor; the third end of the second counting unit is used to output the timing signal, and the second end of the second counting unit is used to output the second count value to the processor; The second input end of the comparison unit is used to receive a preset time, and the output end of the comparison unit is connected to the processor; The comparison unit is used to output a calculation signal when the second count value is equal to the preset time; the calculation signal is used to control the processor to obtain the rotation speed of the rotating shaft according to the first count value and the second count value.

5. The circuit according to claim 4, characterized in that The orthogonal decoding unit is further configured to detect a rotation direction of the rotating shaft, and when the rotation direction of the rotating shaft changes, generate a reset signal and send the reset signal to the first counting unit and the second counting unit; The reset signal is used to control the first counting unit and the second counting unit to re-count.

6. The circuit according to claim 4, characterized in that The second timer further includes a register unit, a first end of the register unit is connected to the second counting unit, a second end of the register unit is connected to the first timer, and is configured to receive the trigger signal and store the second count value according to the trigger signal; The third end of the register unit is connected to the processor and is used to send the second count value to the processor.

7. The circuit according to claim 4, characterized in that The circuit further includes a speed register, a first end of the speed register is connected to the processor, and a second end of the speed register is connected to the second counting unit; The speed register is used to store the rotation speed of the rotating shaft calculated by the processor and send a speed measurement completion signal to the second counting unit; the speed measurement completion signal is used to control the second counting unit to start timing.

8. The circuit according to claim 7, characterized in that The circuit further includes a controller, and the second timer further includes a frequency dividing unit; a first terminal of the controller is connected to the third terminal of the speed register, a second terminal of the controller is connected to the first terminal of the frequency dividing unit, and a second terminal of the frequency dividing unit is connected to the second counting unit; The controller is used to receive the rotation speed of the rotating shaft and set the frequency division coefficient according to the rotation speed of the rotating shaft; The frequency division unit is used to receive the frequency division coefficient; the frequency division coefficient is used to adjust the counting frequency of the second timer.

9. The circuit according to claim 8, characterized in that The controller is further connected to the comparison unit, and is configured to adjust a preset time of the comparison unit according to the rotation speed of the rotating shaft, so as to improve the calculation efficiency of the rotation speed of the rotating shaft.

10. A method for measuring speed of an encoder, characterized in that: Applied to the encoder speed measurement circuit according to any one of claims 1 to 9, the method comprising: The first timer obtains a first count value according to the pulse signal; the first timer outputs a trigger signal according to the pulse signal; the first count value is used to represent the number of rotations of the rotating shaft; The second timer receives the trigger signal and starts synchronous timing according to the trigger signal, and outputs a second count value after the timing is completed; the second count value is used to represent the rotation time of the rotating shaft; The processor obtains the rotation speed of the rotating shaft according to a first count value output by the first timer and a second count value output by the second timer.

11. The encoder speed measurement method according to claim 10, characterized in that: The method further comprises: The processor stores the rotation speed of the rotating shaft in a speed register; The speed register sends the rotation speed of the rotating shaft to the controller; The controller receives the rotation speed of the rotating shaft and adjusts the frequency division coefficient and the preset time according to the rotation speed of the rotating shaft; The second timer adjusts the second count value according to the frequency division coefficient and the preset time.

12. An encoder system, characterized in that The device comprises an encoder speed measurement circuit as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Speed measuring method and system based on increment type photoelectric encoder

    CN102495226A

  • Method and system for speed measurement of rotary encoder

    CN105842473A

  • Incremental photoelectric encoder-based M / T variable speed measuring method

    CN109283354A

  • Acquisition system and method of incremental encoder based on distributed timers

    CN109737995A

  • Pulse width modulation method, circuit and chip

    CN119401990A