Method for determining the rotation direction and effective conversion of orthogonal pulses
By calculating the transition code and using quadrant identification numbers and equations to quickly identify the rotation direction and illegal transitions in the orthogonal encoder, the problem of slow software implementation in the existing technology is solved and the response speed and accuracy of the encoder are improved.
Patent Information
- Application Number
- CN202111085605.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2016-07-29
- Filing Date
- 2017-07-19
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2037-07-19
AI Technical Summary
When the existing technology identifies the motion direction and illegal edge transitions in the orthogonal encoder, the software implementation is slow, and it is difficult to detect and identify the motion direction and illegal transitions quickly and accurately.
The quadrant identification number is formed by shifting the first signal to the left and increasing the second signal value, calculating the transition code using the current and past quadrant identification numbers, determining the direction of rotation of the axis, and updating the quadrant identification number after the sampling interval, using Eq. Shift codes to quickly identify rotation direction and illegal shifts.
It realizes the rapid identification of the rotation direction and illegal transformation of the shaft, improves the response speed and accuracy of the encoder, and is suitable for the detection of the rotation direction of the shaft.
Smart Images

Figure CN113790742B_ABST
Abstract
Description
[0001] This application is a divisional application of Chinese patent application 201710590129.6 filed on July 19, 2017 and entitled “Method for determining the rotation direction and effective transformation of orthogonal pulses”. Technical Field
[0002] The disclosed embodiments relate generally to the field of tracking rotational motion, such as in electric motors. More specifically, and without intending to be limiting, the present disclosure relates to methods of determining rotational direction and efficient transition of orthogonal pulses. Background Art
[0003] Two basic types of encoders or transducers are used to convert the angular motion of a shaft or axle into signals: quadrature encoders and sinusoidal encoders. These encoders use two sensors placed ninety electrical degrees apart to provide two quadrature signals, A and B, and an optional third sensor that provides an output reference once per revolution. Directional information is encoded in the phase relationship between the signal pairs; where input A leads or lags input B by 90 degrees. There are typically several thousand electrical cycles per rotation of the shaft.
[0004] A quadrature encoder delivers a pair of digital signals (A and B, which can be either logic 1 or 0) that change state through the input position. Relative position measurements are obtained by counting the number of edges; the cumulative count increments or decrements depending on the direction of movement. Sine encoders provide two analog signals that provide higher position and velocity resolution. The hardware or software techniques used to interface to the encoder can have a measurable impact on the achieved position resolution and accuracy. A quadrature phase relationship is always maintained between signal A and signal B, so a simultaneous change of both inputs is an illegal condition and usually indicates a problem with the encoder or wiring.
[0005] The decoding device must be able to detect the phase relationship between A and B that identifies the direction of motion, as well as illegal edge transitions. Hardware implementations for identifying these relationships can be very effective; software implementations are typically slower. Improvements are needed. Summary of the invention
[0006] The disclosed embodiment assigns a quadrant identity number ("QID") to each of the four possible input conditions. This number is formed by shifting the logic value of the first signal left by one position and increasing the logic value of the second signal to produce a two-bit binary number in the range of 0 to 3. One method uses the current QID and the most recent previous QID to calculate a transition code. This transition code can quickly identify the direction of movement and can also indicate illegal transitions.
[0007] In one aspect, the present invention discloses an embodiment of a method for determining a rotation direction of a shaft. The method comprises: receiving a first binary signal and a second binary signal from a transducer attached to the shaft, the first binary signal and the second binary signal being orthogonal; and translating a current quadrant identification number QID by shifting the first signal value left and increasing the second signal value. PRESENT Determined as a two-bit binary number; after the sampling interval has passed, the past quadrant identification number QID PAST Set to the QID PRESENT The value of QID PRESENT The new value (new value) and use the QID PRESENT and QID PAST An equation for performing an operation to calculate a transition code value; and using the transition code to determine the rotation direction of the shaft.
[0008] In another aspect, the present invention discloses an embodiment of a non-transitory computer-readable medium having a sequence of program instructions, which when executed by a processor performs a method for determining a rotation direction of a shaft. The method includes: receiving a first binary signal and a second binary signal from a transducer attached to the shaft, the first binary signal and the second binary signal being orthogonal; changing a current quadrant identification number QID by shifting the first signal value left and increasing the second signal value PRESENT Determined as a two-bit binary number; after the sampling interval has passed, the past quadrant identification number QID PAST Set to the QID PRESENT The value of QID PRESENT The new value of QID PRESENT and QID PAST An equation for performing an operation to calculate a transition code value; and using the transition code to determine the rotation direction of the shaft.
[0009] In yet another aspect, the present invention discloses an embodiment of an integrated circuit. The integrated circuit includes: a pulse width modulation (PWM) driver, which is operable to provide a PWM signal for controlling a motor; a connection, which is operable to receive a first binary signal and a second binary signal from a transducer attached to a shaft of the motor; and a feedback loop, which is connected between the connection and the PWM driver, the feedback loop including a sequence of program instructions, which when executed by a processor performs a method for determining a rotation direction of the shaft, the method comprising: shifting a current quadrant identification number QID by shifting the first signal value left and increasing the second signal value PRESENT Determined as a two-bit binary number; after the sampling interval has passed, the past quadrant identification number QID PAST Set to the QIDPRESENT The value of QID PRESENT The new value of QID PRESENT and QID PAST An equation for performing operations to calculate a transition code value;
[0010] And in response to determining that the transition code is valid, using the transition code to determine a rotational direction of the shaft. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Embodiments of the invention are shown by way of example and not limitation in the figures of the accompanying drawings, in which like reference numerals indicate similar elements. It should be noted that different references to "one" or "an" embodiment in the present disclosure are not necessarily to the same embodiment, and such references may mean at least one. In addition, when a particular feature, structure, or characteristic is described in conjunction with an embodiment, it should be considered that it is within the knowledge of a person skilled in the art to make such feature, structure, or characteristic work in conjunction with other embodiments, whether or not explicitly described.
[0012] The accompanying drawings are incorporated into and form a part of this specification to illustrate one or more exemplary embodiments of the present disclosure. Various advantages and features of the present invention will be understood from the following detailed description taken in conjunction with the appended claims and with reference to the accompanying drawings, wherein:
[0013] Figure 1 depicts examples of quadrature signals from transducers and quadrant assignments to those signals in accordance with embodiments of the present disclosure;
[0014] Figure 2 Depicting systems in which the disclosed methods may be used according to embodiments of the present disclosure;
[0015] Figure 3A A flow chart depicting a method of determining a rotational direction of a shaft according to an embodiment of the present disclosure;
[0016] Figure 3B-3D Depicting additional elements of a method of determining a rotational direction of a shaft according to one or more embodiments of the present disclosure;
[0017] Figure 4A Depicted is the sensor arrangement of a conventional quadrature encoder;
[0018] Figure 4B Depicted Figure 4A alignment of code tracks of a quadrature encoder and a waveform associated with rotation of the device;
[0019] Figure 5A and Figure 5B depicts a waveform generated by a sinusoidal encoder and a square wave derived from the sinusoidal waveform, respectively; and
[0020] FIG. 6 depicts a state machine for decoding a square wave provided from a rotating transducer according to the prior art. DETAILED DESCRIPTION
[0021] Specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings. In the following detailed description of various embodiments of the present invention, many specific details are set forth to provide a more complete understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention can be practiced without these specific details. In other cases, well-known features are not described in detail to avoid unnecessarily complicating the description.
[0022] First go to Figure 4A , shows the sensor arrangement of a conventional quadrature encoder. In this example, a rotating disk 402 is attached to a shaft 404 of a device whose rotation speed and direction are to be tracked and / or controlled. A code track 406 runs around the periphery of the rotating disk 402 and is configured to alternately block and allow light to pass through the disk. When a light source 408 is aimed at a light sensor 410 behind the rotating disk 402, the rotation of the disk produces a square wave that tracks the rotation. Figure 4B A closer view is given of the two code tracks (designated Channel A and Channel B) carried on the rotating disk 402, and the signals generated by Channel A and Channel B. It can be seen that the patterns of the two code tracks are offset from each other by a quarter period and produce signals in quadrature.
[0023] A sinusoidal encoder (also called a sincos transducer) is another method of sensing rotation; its advantage is that the exact angle of the sensed axis can be detected with a few calculations. The angle calculation includes a "coarse" portion found by counting orthogonal edges, and a "fine" portion found using the inverse tangent calculation of the sinusoid. Figure 5A Depicted are two signals generated by a sinusoidal encoder. The signals are generated by magnetic sensors, which continuously sense the strength of the magnetic field associated with the rotating shaft, as can be seen from two different sensors. In order to determine the direction of the movement speed, these analog signals are converted into Figure 5B The square wave visible in the code is essentially the same as the signal generated by the earlier code channel. Therefore, it should be understood that although the method described in this application is designed for use with a sinusoidal encoder, the method can also be used with a quadrature encoder.
[0024] FIG6 shows a diagram of the Figure 5BThe orthogonal signal shown is decoded and determines the state machine of the prior art of the direction that the shaft is moving. Four positions 602A, 602B, 602C, 602D are shown in this figure, which carry the corresponding designation of 10, 11, 01, 00 to indicate the value of signal A and signal B. In this case, the leftmost digit in the pair is the value of signal A, and the rightmost digit is the value of signal B. It should be understood that from the position 602A designated as value 10, the clockwise movement of the shaft (which causes the counter to increase) will mean that the next value is 11, and the counterclockwise movement of the shaft (which causes the counter to decrease) will mean that the next value is 00. Because these signals are always in quadrature phase, the transition from 10 to 01 will be an invalid value and will indicate a fault in the received signal. The state machine of Fig. 6 may be implemented in hardware or software. When implemented in hardware, this state machine can be very effective when quickly determining the direction of movement. However, when appropriate hardware state machines are unavailable or impractical, the software implementation of this concept has not yet obtained results in time.
[0025] The applicant has determined that rather than implementing the state machine in software, either of two simple calculations may provide information in a timely manner. The applicant recognizes that the disclosed method is designed to be used with or without power to the shaft whose rotation is measured. In order to ensure that all transitions are captured, the input signal should be sampled at least whenever the input signal may have a transition or edge. If this is done, the method will capture all counts. The disclosed method requires that each time a sampling period has passed, the current signal value is used to determine the transition code. The current transition code and the transition code just passed are then used in a simple mathematical formula that can determine the direction of travel and invalid conversions, as will be explained below. In one embodiment, a transfer code of zero indicates that no conversion has occurred, i.e., the shaft does not rotate or the shaft rotates slowly enough so that a conversion does not always occur during sampling.
[0026] Next turn Figure 1 , this figure depicts an example of quadrature signals A and B from a transducer, and the assignment of quadrature identification numbers (QIDs) to each possible value of those signals. A two-digit binary QID number can be formed by using the value of signal A for the leftmost digit and the value of signal B for the rightmost digit, or in other words by left-shifting the value of signal A and incrementing the value of signal B. A decimal version of the QID is also shown. When both signals are high, the binary value is 11 and the decimal value is 3. Similarly, binary values 10, 00, and 01 become decimal values 2, 0, and 1, respectively; then the sequence begins to repeat as rotation continues.
[0027] The disclosed method uses the current QID (QID PRESENT ), the QID just passed (QID PAST) and a simple equation to determine the direction of rotation and also to identify invalid transitions. Applicants have found two simple equations that can provide the desired information, each with its own advantages. In a first embodiment, the transition code is determined using equation 1:
[0028] TCODE1=2*QID PRESENT -QID PAST Equation 1
[0029] Table 1 shows the valid TCODEs that can be generated using Equation 1. From this table, it can be seen that when the associated shaft rotates in a clockwise manner, the value of TCODE1 proceeds in the sequence 5, 1, -2, 2, 5, 1, -2, 2, etc. Similarly, if the associated shaft rotates in a counterclockwise manner, the value of TCODE1 proceeds in the sequence 4, 4, -1, -1, 4, 4, -1, -1, etc. It is worth noting that the valid values in the clockwise direction do not overlap with the valid values in the counterclockwise direction, so the direction of rotation can be determined very quickly by noting the value of TCODE1.
[0030] QID 3 2 0 1 3 2 Clockwise TCODE1 5 1 -2 2 5 1 Counterclockwise TCODE1 4 4 -1 -1 4 4
[0031] Table 1
[0032] As previously noted, the disclosed method is designed to be used with or without the shaft rotating. Thus, when the shaft is not rotating, it is possible to make the QID PRESENT =QID PAST When using Equation 1, this can result in TCODE values of 3, 2, 0, and 1, depending on the QID when the rotation stops. These values overlap with both valid clockwise TCODE values and illegal codes, so it is not possible to determine from the TCODE whether a transition occurred. Therefore, this determination must be made before applying Equation 1. Table 2 shows all possible transition codes using Equation 1:
[0033] Transformation Code CW CCW illegal No border 6 yes 5 yes 4 yes 3 yes yes 2 yes yes 1 yes yes 0 yes yes -1 yes -2 yes -3 yes
[0034] Table 2
[0035] In a second embodiment, the transition code is determined using Equation 2:
[0036] TCODE2=(QID PRESENT ) 2 –(QID PAST ) 2 Equation 2
[0037] Table 3 shows the effective TCODE that can be generated using Equation 2:
[0038]
[0039] Table 3
[0040] As can be seen, if the associated shaft rotates in a clockwise manner, the values of TCODE2 are generated in the sequence 8, -5, -4, 1, 8, -5, -4, 1, etc. Similarly, if the associated shaft rotates in a counterclockwise manner, the values of TCODE2 are generated in the sequence 5, 4, -1, -8, 5, 4, -1, -8, etc. In the case of using equation 2, the valid values in the clockwise direction do not overlap with the valid values in the counterclockwise direction again, thereby allowing the direction of rotation to be determined very quickly by recording the value of TCODE2. Additionally, however, if no transition occurs because the shaft is not rotating or rotating slower than the sampling interval, the resulting TCODE is always 0. Since this is a unique code and thus does not overlap with both valid and invalid TCODEs, using equation 2 to calculate TCODE can identify when no transition occurs, so that this determination does not need to be made separately.
[0041] Table 4 shows all possible values that can be calculated using Equation 2, and clearly shows that each possible code uniquely identifies whether the value represents clockwise rotation, counterclockwise rotation, an illegal value, or a missing edge. Applicants note that although Equation 2 is more computationally complex than Equation 1, most processors have hardware multipliers that make the computational difference negligible.
[0042] Transformation Code CW CCW illegal No edge 9 yes 8 yes 5 yes 4 yes 3 yes 1 yes 0 yes -1 yes -3 yes -4 yes -5 yes -8 yes -9 yes
[0043] Table 4
[0044] Figure 2 2 is a block diagram of a motor control system in which the disclosed method can be used according to an embodiment of the present disclosure. The motor control system 200 includes four main elements: a motor 202, a three-phase inverter 204, an orthogonal encoder 212, and a digital signal processing (DSP) chip 208. The three-phase inverter 204 contains multiple high-power switches and provides power to the motor 202, which can be, for example, a washing machine motor, an A / C pump, etc. The three-phase inverter 204 is controlled by a digital signal processor (DSP) 208. The orthogonal encoder 212 is attached to the shaft of the motor 202 to generate a signal that can be used to determine the rotor angle measurement value. The output from the encoder includes square wave signals QEP_A and QEP_B that are directly connected to the input of the DSP 208.
[0045] DSP 208 includes several modules that work together to provide signals that will control motor 202 through three-way inverter 204. DSP 208 includes PWM driver 206, which generates switching waveforms PWM1-PWM6 that drive switches in three-phase power inverter 204. Three connectors (not specifically shown) receive inputs from quadrature encoder 212, which in this embodiment include quadrature signals QEP_A, QEP_B, and QEP_INDEX. The rest of DSP 208 utilizes the signals received from quadrature encoder 212, the signals ADCIN received from three-phase inverter 204, and the PWM driver 206 to generate switching waveforms PWM1-PWM6 that drive switches in three-phase power inverter 204. X (Ia), ADCIN X (Ib) and ADCINx (VDC), and programmable inputs for gain and offset received at ILEG2DRV228 to provide a feedback loop to the PWM driver 206. The feedback loop includes: quadrature encoder pulse driver (QEP DRV) 214, ILEG2DRV 228, speed and frequency module 230, Clark module 218, Parker module 220, reverse Parker module 222, SVGEN module 224, PID-REG module 226, and some modules not discussed in detail. QEP 214 receives signals QEP_A and QEP_B, determines the rotor position, and generates a rotation direction signal based on the shaft position encoder pulses. The quadrature encoder pulse driver 214 provides four outputs: motor electrical angle (ELEC_THETA), motor mechanical angle (THETA_MECH), motor rotation direction (DIRECTIONQEP) and index synchronization status (INDEXSYNCFLAG). ELEC_THETA is used to provide the rotor angle 216 to other modules within the DSP 208.
[0046] The Pike transform module 220 and the inverse Pike transform module 222 convert vectors between a balanced two-phase quadrature stationary frame and an orthogonal rotating reference frame. The Clark transform module 218 converts the balanced two-phase quadrature quantity into a balanced three-phase quantity. The space vector with quadrature control (SVGEN) 224 uses space vector PWM technology to calculate the appropriate duty cycle required to generate a given stator reference voltage. ALPHA and U BETAto describe the stator reference voltage. The proportional and integral regulator (PID-REG) 226 is a software module that implements two PI regulators with integral saturation correction. The dual inverter leg resistor based load current measurement driver (ILEG2DRV) 228 is a driver module that converts two analog inputs into digital representations with programmable gain and offset. The conversion result represents the load current of the three-phase voltage source inverter under known conditions. The DSP 208 uses the obtained rotor angle 216 and additional data derived from the collected information in order to implement the control algorithm for controlling the motor 202. Figure 2 Additional documentation for the system shown is available in the document titled “PMSM3-1 System Documentation” located at ti.com, which is incorporated herein by reference.
[0047] Figure 3A A method for determining the direction of rotation of a shaft is disclosed. The method begins with a digital signal processor receiving 302 two orthogonal binary signals. In one embodiment, the two binary signals are generated by an orthogonal encoder (such as the orthogonal encoder 214). In one embodiment, a sinusoidal transducer generates analog quadrature signals, which are then converted to the received binary signals. The DSP converts the current quadrature identification number QID to the current quadrature identification number QID by left-shifting the value of the first binary signal and increasing the value of the second binary signal. PRESENT Determine 304 that the two-digit number is a two-digit number. The method determines 306 whether a sampling period has passed. As previously noted, a sampling period occurs at least once each transition may occur. If the sampling period has not passed, the method waits until the sampling period has passed. Once the sampling period has passed, the method passes the past quadrant identification number QID PAST Set 308 as QID PRESENT Continue with the value of 310QID PRESENT The new value of QID PRESENT and QID PAST The method then determines 314 whether the calculated transition code is invalid. If the transition code is invalid, the method executes 316 an invalid transition code routine. The actual operation of the invalid transition code routine is not within the scope of the present patent application and is not discussed herein. If the transition code is not invalid, the method uses 318 the transition code to determine the direction of rotation of the shaft. This information can then be used to track or control the motor, thereby adjusting the operation of the motor as desired.
[0048] As part of determining the direction of rotation of the shaft, it is desirable to determine whether a transition has occurred. However, as mentioned previously, a transition code may be used to make a determination of when to use Equation 2, rather than when to use Equation 1. Figure 3B A determination is made when using Equation 1. In this embodiment, determining 320 whether a transition has occurred will occur in element 310 to determine the QID PRESENT , but before the value of the transition code is calculated 312. If no transition has occurred, the method returns to entry point A to determine whether a new sampling interval has passed. If a transition has occurred, the method proceeds to entry point B, where a new value of the transition code is calculated.
[0049] On the other hand, Figure 3C This determination of when to use Equation 2 is depicted. In this embodiment, the determination can be made after the transition code has been calculated and determined to be valid. If a transition has not occurred, the method returns to entry point A again to determine whether a new sampling interval has passed. If a transition has occurred, the method proceeds to entry point C where the transition code is used to determine the direction of rotation of the shaft. For embodiments using either Equation 1 or Equation 2, Figure 3D Further details of using the transition code to determine the direction of rotation are disclosed. The method determines 324 whether the transition code identifies a clockwise rotation. Since, as already discussed, the transition code uniquely identifies whether the shaft is turning in a clockwise or counterclockwise direction, this can be quickly determined using the value of the transition code. If the rotation is not clockwise, a counter counting transitions is decremented; if the rotation is clockwise, the counter is incremented.
[0050] Applicants have disclosed a method of determining the direction of rotation of a shaft by a simple calculation that uses the current quadrant identification number and the past quadrant identification number to calculate a transition code. Utilizing the transition code also enables detection of illegal transitions in a received signal, and in one embodiment also indicates when no transition has occurred in the signal. The direction of rotation can be used to increment or decrement a counter. The direction and speed of rotation derived from the same signal can then be used by a controller to control the speed and / or position of the shaft.
[0051] Although various embodiments have been shown and described in detail, the claims are not limited to any specific embodiment or example. None of the above detailed descriptions should be considered to imply that any specific component, element, step, behavior, or function is necessary, so that it must be included in the scope of the claims. Reference elements in the singular are not intended to mean "one and only one" (unless clearly expressed as such), but "one or more". All structural and functional equivalents of the elements of the above-described embodiments known to those of ordinary skill in the art are expressly incorporated herein by reference, and are intended to be included by the present claims. Therefore, those skilled in the art will recognize that the exemplary embodiments described herein can be practiced by various modifications and changes within the spirit and scope of the following claims.
Claims
1. A method for determining a rotation direction, comprising: receiving a first binary signal and a second binary signal, wherein the first binary signal and the second binary signal are orthogonal to each other; Based on the first binary signal and the second binary signal, determine the current quadrant identification number (QID) PRESENT ; After the sampling interval has passed, the past quadrant identification number, i.e., QID PAST Set as QID PRESENT The value of QID PRESENT The new value of Determining QID PRESENT After that, the new value is determined as QID PRESENT and QID PAST The transition code of the function, wherein the QID used to determine the transition code PRESENT and QID PAST The function is: (2*QID PRESENT )-QID PAST ; as well as In response to determining that the transition code is valid, determining a rotational direction using the transition code, generating a rotational direction signal indicative of the rotational direction, generating at least one control signal based on the rotational direction signal, and controlling a motor using the at least one control signal.
2. The method according to claim 1, wherein the QID PRESENT is a two-bit binary number, and wherein the QID is determined based on the first binary signal and the second binary signal PRESENT The method comprises left-shifting the value of the first binary signal to obtain an intermediate value, and then adding the intermediate value to the value of the second binary signal. 3 . The method of claim 1 , further comprising, in response to determining that the transition code is invalid, performing an invalidate transition code routine. The method of claim 1 , wherein the determined rotational direction represents the rotational direction of a shaft operable to drive the electric motor.
5. The method according to claim 1 further comprises: PRESENT After the new value is determined as QID PRESENT and QID PAST Before the value of the transition code of the function, it is determined whether a transition has occurred.
6. The method according to claim 5, further comprising: In response to determining that a transition has not occurred, waiting for a next sampling period to pass; as well as In response to determining that a transition has occurred, using the QID PRESENT and QID PAST The function calculates an updated value of the transition code.
7. The method of claim 1, wherein the transition code is: a value from a first set of values when the rotation direction is a first direction; when the direction of rotation is a second direction opposite to the first direction, a value from a second set of values, wherein each value in the first set of values is different from each value in the second set of values; and When the transition code is determined to be invalid, a value from a third set of values, wherein each value in the third set of values is different from each value in the first set of values and the second set of values. The method of claim 1 , wherein the second binary signal is a transducer signal.
9. An electronic device comprising: one or more inputs to receive a first binary signal and a second binary signal, the first binary signal and the second binary signal being orthogonal to each other; a processor coupled to the one or more inputs; and a memory coupled to the processor to store instructions that, when executed by the processor, cause the processor to: Based on the first binary signal and the second binary signal, determine the current quadrant identification number (QID) PRESENT ; After the sampling interval has passed, the past quadrant identification number, i.e., QID PAST Set as QID PRESENT The value of QID PRESENT The new value of Determining QID PRESENT After that, the new value is determined as QID PRESENT and QID PAST The transition code of the function, wherein the QID used to determine the transition code PRESENT and QID PAST The function is: (2*QID PRESENT )-QID PAST ; as well as In response to determining that the transition code is valid, determining a rotation direction using the transition code, generating a rotation direction signal indicative of the rotation direction, generating a motor control signal based on the rotation direction signal, and outputting the motor control signal.
10. The electronic device according to claim 9, wherein the QID PRESENT is a two-bit binary number, and wherein the QID is determined based on the first binary signal and the second binary signal PRESENT The method comprises left-shifting the value of the first binary signal to obtain an intermediate value, and then adding the intermediate value to the value of the second binary signal.
11. The electronic device of claim 9, wherein the instructions, when executed by the processor, further cause the processor to determine the QID PRESENT After the new value is determined as QID PRESENT and QID PAST Before the value of the transition code of the function, it is determined whether a transition has occurred.
12. The electronic device of claim 11, wherein the instructions, when executed by the processor, further cause the processor to: In response to determining that the transition has not occurred, waiting for the next sampling period to pass; and In response to determining that a transition has occurred, using the QID PRESENT and QID PAST The function calculates an updated value of the transition code.
13. The electronic device of claim 9, wherein the electronic device is an integrated circuit.
