Signal modulation circuit and motor driving device

By designing a signal modulation circuit in the timer, adjusting the count threshold and control signals, the problem of insufficient flexibility in the timer output waveform is solved, and the ipsilateral flip is realized within half a counting cycle and the output spans one counting cycle is achieved. More complex user needs.

CN119070791APending Publication Date: 2024-12-03SMART MICROELECTRONICS (SUZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411091270.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-09
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing timer output waveforms are less flexible and cannot handle complex work efficiently, resulting in the inability to meet diverse user needs in some applications.

Method used

Design a signal modulation circuit, including comparison circuit, control circuit and output circuit, by adjusting the count threshold value and control signal of the timer, to achieve flexible comparison of count values ​​during rising and falling trends, breaking the limitations of the traditional center alignment mode, so as to make The output waveform achieves flipping and output spanning one count cycle in half a count cycle.

Benefits of technology

Improves the flexibility of the timer output waveform, allowing it to achieve ipsilateral flips and outputs across one counting cycle within half a counting cycle, meeting more user needs and implementing a more complex waveform output mode.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119070791A_ABST
    Figure CN119070791A_ABST
Patent Text Reader

Abstract

The invention discloses a signal modulation circuit and a motor driving device, and relates to the technical field of signal modulation. The signal modulation circuit is used for a timer and comprises a comparison circuit configured to compare a count value of the timer with a first threshold value and a second threshold value of each channel based on a control signal and output a comparison result to an output circuit; wherein the first threshold value and the second threshold value of each channel are adjustable, the first threshold value of each channel is smaller than or equal to the second threshold value when the count value is in an ascending trend, and the first threshold value of each channel is larger than or equal to the second threshold value when the count value is in a descending trend; the control circuit is configured to generate a control signal and output the control signal to the comparison circuit and the output circuit, and the control signal is used for selectively conducting the multiplexers in the comparison circuit and the output circuit; and an output circuit configured to receive a result of the comparison and output a modulated signal based on the control signal. The circuit improves the flexibility of the output waveform of the timer.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of signal modulation, and in particular to a signal modulation circuit and a motor drive device. Background Art

[0002] A timer is an electronic device or circuit used to generate precise time interval signals. It is widely used in various electronic devices and systems, such as computers, microcontrollers, automation systems, and communication equipment. The timer uses its internal counter and clock source to achieve the function of timing interrupt or trigger; the counter counts up or down according to the frequency of the clock source, and when the count reaches the preset value, the timer function is activated.

[0003] The commonly used counting mode in the timer is the center alignment mode, that is, the count first increases from 0 to the maximum value, and then decreases from the maximum value to 0. In the prior art, this technical mode can only make the output waveform of the timer realize waveform flipping on both sides of the symmetry center, resulting in low flexibility of the timer output waveform and low efficiency in processing complex work. Therefore, how to improve the flexibility of the timer output waveform so that it can efficiently process complex work is a problem to be solved. Summary of the invention

[0004] In view of this, the present application discloses a signal modulation circuit and a motor driving device, which are used to improve the flexibility of the timer output waveform.

[0005] In a first aspect, the present application discloses a signal modulation circuit for a timer, the timer comprising at least one channel, and the signal modulation circuit comprising: a comparison circuit, a control circuit and an output circuit; wherein the comparison circuit is configured to compare the count value of the timer with a first threshold value and a second threshold value of each channel based on a control signal, and output the comparison result to the output circuit; wherein the first threshold value and the second threshold value of each channel are adjustable, and when the count value is on an upward trend, the first threshold value of each channel is less than or equal to the second threshold value, and when the count value is on a downward trend, the first threshold value of each channel is greater than or equal to the second threshold value; the control circuit is configured to generate a control signal and output the control signal to the comparison circuit and the output circuit, the control signal being used to select and turn on a multiplexer in the comparison circuit and the output circuit; the output circuit is configured to receive the comparison result and output a modulated signal based on the control signal.

[0006] Optionally, the counting mode of the timer is a center-aligned mode; in one counting cycle, the time when the count value is in an upward trend is equal to the time when the count value is in a downward trend, and the process of the count value reaching the maximum value from the minimum value or reaching the minimum value from the maximum value is half a counting cycle.

[0007] Optionally, at least one channel includes a first channel, and a comparison result in the first channel is a first comparison result; the output circuit receives the first comparison result so that an output waveform of the first channel is flipped in half a counting cycle.

[0008] Optionally, at least one channel further includes a second channel, a third channel and a fourth channel, the comparison result in the second channel is a second comparison result, the comparison result in the third channel is a third comparison result, and the comparison result in the fourth channel is a fourth comparison result; the output circuit receives the second comparison result, the third comparison result and the fourth comparison result, so that the output waveform of the second channel, the output waveform of the third channel and the output waveform of the fourth channel are flipped in half a counting cycle; wherein the first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to the second phase difference between the output waveform of the second channel and the output waveform of the fourth channel.

[0009] Optionally, the first phase difference and the second phase difference are 180 degrees, and the output waveforms of each channel are in the same counting cycle.

[0010] Optionally, at least one channel includes a first channel, a second channel, a third channel and a fourth channel, the comparison result in the first channel is a first comparison result, the comparison result in the second channel is a second comparison result, the comparison result in the third channel is a third comparison result, and the comparison result in the fourth channel is a fourth comparison result; the output circuit receives the first comparison result, the second comparison result, the third comparison result and the fourth comparison result, and outputs an output waveform of the first channel, an output waveform of the second channel, an output waveform of the third channel and an output waveform of the fourth channel; wherein a first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to a second phase difference between the output waveform of the second channel and the output waveform of the fourth channel.

[0011] Optionally, the first phase difference and the second phase difference are 180 degrees, and an output waveform group consisting of output waveforms of each channel in one cycle spans two adjacent counting cycles.

[0012] Optionally, the control signal includes a first signal and a second signal, and the first signal and the second signal enable the count value to be compared with a first threshold and a second threshold of each channel when the count value is in an upward trend or a downward trend.

[0013] Optionally, the control circuit is further configured to generate a third signal, and the third signal is used to adjust the first threshold and the second threshold of each channel when the count value changes from an upward trend to a downward trend or from a downward trend to an upward trend.

[0014] In a second aspect, the present application discloses a motor drive device, comprising the signal modulation circuit disclosed in the first aspect above.

[0015] The signal modulation circuit and motor drive device disclosed in the present application have at least the following beneficial effects:

[0016] (1) By resetting the relevant comparison threshold before the timer count is rolled over, the timer output waveform is made more flexible and can meet more user needs.

[0017] (2) By controlling the comparison trigger points of the rising increment count and the falling decrement count, the limitation of the prior art that only one PWM counting cycle can be output with the counter reversal point as the center position is broken, and the waveform output with the same side flipped within half a cycle and the cross-cycle waveform output spanning one PWM counting cycle are realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The following is a brief introduction to the drawings used in describing the embodiments of the present application:

[0019] Figure 1 It is a schematic diagram of a timer output waveform in the prior art;

[0020] Figure 2 It is another schematic diagram of timer output waveform in the prior art;

[0021] Figure 3 is a structural schematic diagram of a signal modulation circuit provided in an embodiment of the present application;

[0022] Figure 4 is a schematic diagram of a timer-related waveform provided in an embodiment of the present application;

[0023] Figure 5 It is a schematic diagram of another timer-related waveform provided in an embodiment of the present application. DETAILED DESCRIPTION

[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. The accompanying drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other accompanying drawings and other implementation methods can be obtained based on these drawings without creative work. Adjustments and improvements made without departing from the concept of the present application are all within the scope of protection of the present application.

[0025] In order to simplify the drawings, only the parts related to the corresponding embodiments are schematically shown in each figure, and they do not represent the actual structure of the product. In addition, in order to simplify the drawings and facilitate understanding, only part of the components with the same structure or function in some figures are schematically drawn, and there may be more or fewer components with the same structure or function in reality.

[0026] In this application, unless otherwise clearly specified and limited, ordinal numbers, such as "first", "second", etc., are only used to distinguish and describe associated objects, and cannot be understood as indicating or implying the relative importance or order between associated objects; in addition, they do not represent the number of associated objects. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between associated objects, which indicates the "or" relationship between associated objects. "And / or" is used to describe the relationship between associated objects, which includes any combination relationship between associated objects, such as "a and / or b" includes: "alone a", "alone b", or "a and b". "One or more" or "at least one" in multiple objects refers to any object or any combination of multiple objects, such as "one or more of a1, a2, a3" or "at least one of a1, a2, a3" includes: "alone a1", "alone a2", "alone a3", "a1 and a2", "a1 and a3", "a2 and a3", or "a1, a2 and a3".

[0027] A timer is an electronic device or circuit used to generate precise time interval signals. It is widely used in various electronic devices and systems, such as computers, microcontrollers, automation systems, and communication equipment. A timer consists of a counter and a clock source. The counter counts up or down according to the frequency of the clock source. When the count reaches a preset value, the timer generates an interrupt or triggers an event. In terms of type, timers can be divided into hardware timers and software timers. Among them, the hardware timer is integrated into the microcontroller or other chip, and the timing function is realized by configuring registers. Common hardware timers include: monostable timer, which is used to generate a single time interval signal; multistable timer, which is used to generate periodic signals. Software timers simulate the functions of hardware timers through software algorithms, which are more flexible, but may not be as accurate and reliable as hardware timers. In terms of application, timers can realize time delay, periodic task scheduling, pulse width modulation (PWM), and time interval measurement, for example.

[0028] The timer counting mode includes the center-aligned mode, or symmetrical triangle wave. In this counting mode, the counter starts from zero and increments to the set maximum value, and then decrements back to zero, thus forming a complete counting cycle. For example, the count is: 0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0, so the count value is symmetrical around 5. The process of increasing from 0 to 5 is an upward trend; the process of decreasing from 5 to 0 is a downward trend.

[0029] The comparison trigger of the existing timer can set the phase shift function, that is, the trigger value of the rising increment count and the falling decrement count of the output waveform in the PWM mode count can be set by the two groups of registers CCRx and CCRxFALL respectively, so that the position of the upper and lower edges of the output waveform from the center point can be freely adjusted. Among them, CCRx is the capture / compare register group of the timer (capture / compare register), x refers to the channel number, for example, if the timer includes 4 channels, the value range of x is 1-4; CCRxFALL is the timer phase shift decrement capture / compare register group (capture / compareregister in fall count), and the meaning of x is the same as above. Please refer to Figure 1 , which shows a schematic diagram of a timer output waveform in the prior art. Figure 1 As shown in the figure, taking the first channel of the timer as an example, the timer has gone through 2 cycles, in which the count value CNT in the coordinate diagram increases from 0 to the maximum value ARR, and then decreases from the maximum value ARR to 0, which is a process of 1 cycle. CCR1 and CCR1FALL correspond to the comparison thresholds set by the two registers of the first channel respectively. CEN is the abbreviation of counter enable, which is a control bit in the timer or counter module, used to enable or disable the counting function of the counter. Enabling the CEN bit will start the counter and make it start counting according to the set counting mode; disabling the CEN bit will stop the counter from counting. CCR1SHIFTEN is the phase shift enable bit. When it is 0, the comparison function of the timer only considers the value of CCR1 in both the rising trend and the falling trend, and does not consider the value of CCR1FALL; when it is 1, the comparison function of the timer considers the value of CCR1 in the rising trend, and considers the value of CCR1FALL in the falling trend. OC1REF represents the output waveform of the first channel of the timer. Figure 1The output waveform is divided into two sections: "1" and "2". The difference between the two is whether CCR1SHIFTEN is set to 1. In the "1" section, the phase shift function is disabled. The upper and lower edges of the output waveform are compared and triggered by the value of CCR1, and the distance between the upper and lower edges and the center position is the same. In the "2" section, the phase shift function is enabled. The upper and lower edges are compared and triggered by the set values ​​of CCR1 and CCR1FALL, respectively. In this way, a waveform with inconsistent distances between the upper and lower edges and the center position can be obtained. Compared with the "1" section, the "2" section sets CCR1SHIFTEN to 1, making the output waveform of the timer more flexible and not completely symmetrical based on the turning point of the count value. However, this design will cause the upper and lower edges of the output waveform to be located only on both sides of the center position, that is, it is impossible to achieve two flips within half a PWM count cycle of rising increment or falling decrement to obtain a complete pulse output.

[0030] In addition, the design of the existing technology will also cause the waveforms output by each channel of the timer to be confined to one counting cycle. Figure 2 , which shows another schematic diagram of a timer output waveform in the prior art. Figure 2 As shown, the timer includes four channels, and the comparison thresholds of the corresponding registers are CCR1, CCR2, CCR3 and CCR4, and the output waveforms are OC1REF, OC2REF, OC3REF and OC4REF. Figure 2 It can be seen that in the prior art, no matter how the comparison threshold of the capture / compare register group is set, the output waveform of the corresponding channel is all confined to one counting cycle. This makes the output waveform of the timer not flexible enough and unable to efficiently complete some complex tasks. For example, in the PWM complementary waveform output mode of the existing timer, the 4-way output is limited to one PWM counting cycle of the timer. When it is required to achieve 180° phase orthogonality, the actual period of the 4-way output waveform combination is more than one PWM counting cycle, which requires the timer to output 4 complementary waveforms across the PWM counting cycle to meet the demand. Based on the above deficiencies in the prior art, the idea of ​​the present application is to redesign the internal circuit of the timer to improve the flexibility of its output waveform, and enable its output waveform to achieve the same-side flipping of the upper and lower edges within half a PWM counting cycle and the period of the 4 groups of output waveforms spanning one PWM counting cycle.

[0031] The present application discloses a signal modulation circuit for a timer, wherein the timer comprises at least one channel, and the signal modulation circuit comprises: a comparison circuit, a control circuit and an output circuit; wherein the comparison circuit is configured to compare the count value of the timer with a first threshold value and a second threshold value of each channel based on a control signal, and output the comparison result to the output circuit; wherein the first threshold value and the second threshold value of each channel are adjustable, and when the count value is in an upward trend, the first threshold value of each channel is less than or equal to the second threshold value, and when the count value is in a downward trend, the first threshold value of each channel is greater than or equal to the second threshold value; the control circuit is configured to generate a control signal, and output the control signal to the comparison circuit and the output circuit, and the control signal is used to select and turn on the multiplexer in the comparison circuit and the output circuit; the output circuit is configured to receive the comparison result, and output the modulated signal based on the control signal.

[0032] Please refer to Figure 3 , which shows a structural schematic diagram of a signal modulation circuit provided in an embodiment of the present application. Figure 3The marks in are as follows: u_timer1 refers to the timer, including the comparison circuit and control circuit of the signal modulation circuit of the present application; u_tim1_ocx is the timer output control, including the output circuit of the signal modulation circuit of the present application. PDER is the phase shift function enable setting register. ccrx_shadow is the shadow register corresponding to the ccrx register, ccrxfall_shadow is the shadow register corresponding to the ccrxfall register, the comparison threshold stored in the shadow register is the same as the comparison threshold stored in the register itself, and the value on the shadow register can be adjusted during the counting process. The control circuit is also configured to generate a third signal, which is used to adjust the first threshold and the second threshold of each channel when the count value changes from an upward trend to a downward trend or from a downward trend to an upward trend. The first threshold and the second threshold are the values ​​of ccrx and ccrxfall, that is, the values ​​stored in the shadow register. By resetting the relevant comparison threshold before the count of the timer is flipped, the timer output waveform is more flexible and can meet more user needs. hw_dir is the counting direction mark of the timer counter. When hw_dir is 0, it means that the count is in an upward trend. When hw_dir is 1, it means that the count is in a downward trend. ocxfe_valid is the output enable signal of the comparison match signal. ccrxfallrs is an enable signal that allows a comparison match with ccrxfall to occur during the rising counting process. ccrx_fallrs is the result of the logical AND operation of the ccrxfallrs signal and the ccrxshiften signal. The control signal includes a first signal and a second signal. The first signal and the second signal can be the above ccrxfallrs signal and the ccrxshiften signal respectively. The ccrxfallrs signal and the ccrxshiften signal are output by PDER. Among them, the first signal and the second signal enable the count value to be compared with the first threshold and the second threshold of each channel when it is in an upward trend or a downward trend. cnt is the count value of the timer, cnt_eq_ccrx is the flag signal when the count value is equal to the value set in the ccrx register, cnt_gt_ccrx is the flag signal when the count value is greater than the value set in the ccrx register, and cnt_lt_ccrx is the flag signal when the count value is less than the value set in the ccrx register. ocxref is the output waveform of the xth channel of the timer.

[0033] Figure 3 This is a digital circuit diagram for any channel in the timer, including logic gates (AND gates, OR gates, and NOT gates) and multiplexers. The connection between the components can be referred to Figure 3The connection method in is implemented. When the timer is working, both the ccrxfalls and ccrxshiften signals are set to 1, so that the first path of the multiplexer (including the zeroth path and the first path) in the comparison circuit and the output circuit can be turned on. In terms of implementation effect, taking the cnt_eq_ccrx signal as an example, compared with the prior art, when the count value is equal to ccrx in an upward trend or equal to ccrxfall in a downward trend, the circuit design of the present application can make cnt_eq_ccrx signal triggered when cnt is equal to any value of ccrx or ccrxfall in an upward trend or a downward trend.

[0034] In some implementations, by setting the comparison values ​​of ccrx and ccrxfall, the upper and lower edges of the output waveform can be flipped on the same side within half a PWM counting cycle, and the four groups of outputs can achieve phase-orthogonal output waveforms within one PWM cycle.

[0035] Exemplarily, the signal modulation method may include the following steps: before the enable bit is set, the value of ccr1 is set to 0, the value of ccr1fall is set to 1 / 4 of the counter peak value (i.e., the maximum value of the counter), ccr2 is set to 1 / 2 of the peak value, ccr2fall is set to 3 / 4 of the peak value, the values ​​of ccr3 and ccr3fall are both set to 0, and the values ​​of ccr4 and ccr4fall are both set to 0. Then the enable bit is set to start the comparison output mode, then in the first rising count, the output of channel 1 is the waveform of oc1ref, the output of channel 2 is the waveform of oc2ref, channels 3 and 4 will not flip, and the output oc3ref and oc4ref remain at a low level. Before the rising and falling counts at the 180° position are switched to refresh the shadow register data, the set value is modified, the values ​​of ccr1 and ccr1fall are both set to 0, the values ​​of ccr2 and ccr2fall are both set to 0, the value of ccr3 is set to the peak value, the value of ccr3fall is set to 3 / 4 of the peak value, the value of ccr4 is set to 1 / 2 of the peak value, and the value of ccr4fall is set to 1 / 4 of the peak value. After switching to the falling count, the output waveforms of channel 1 and channel 2 will not flip, while channel 3 and channel 4 will be compared and matched, and the waveforms of oc3ref and oc4ref will be output respectively. Before switching at the 0° position, the value of the register is reset to the initial value of the method. In this way, the waveform output that flips on the same side within half a cycle can be achieved. Repeat the above steps to obtain waveforms of multiple cycles. Among them, the first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to the second phase difference between the output waveform of the second channel and the output waveform of the fourth channel. In some embodiments, the first phase difference and the second phase difference are 180 degrees, and the output waveforms of each channel are in the same counting cycle. In this way, the functional requirement of 180-degree phase orthogonality is achieved, and the flexibility of the output waveform is improved.

[0036] Please refer to Figure 4 , which shows a schematic diagram of a timer-related waveform provided in an embodiment of the present application. Figure 4 The output waveform of each channel is the output result of the above signal modulation method. Figure 4 There are three counting cycles. In one counting cycle, the time when the count value is in an upward trend is equal to the time when the count value is in a downward trend, and the process of the count value reaching the maximum value from the minimum value or reaching the minimum value from the maximum value is half a counting cycle. In any of the counting cycles, the output waveform of each channel can be continuously flipped when the count value is in an upward trend or in a downward trend. Taking the first channel as an example, that is, Figure 4 The comparison result in the first channel is the first comparison result. The output circuit receives the first comparison result, so that the output waveform of the first channel is flipped in half a counting cycle.

[0037] Exemplarily, the signal modulation method may further include the following steps: before enabling, the value of ccr1 is set to a, the value of ccr1fall is set to be greater than the value of arr (i.e., the maximum value that the count value can reach), the values ​​of ccr2 and ccr2fall are both set to 0, the values ​​of ccr3 and ccr3fall are both set to 0, the value of ccr4 is set to 0, and the value of ccr4fall is set to d. When the set values ​​of ccrx and ccrxfall are greater than the maximum value of the counter, the flip condition cannot be generated, and the output waveform will not flip. When enabling is set and the comparison output mode is started, in the rising count, channels 1 and 4 will generate comparison match conditions and output the waveforms of oc1ref and oc4ref, while channels 2 and 3 will not have comparison match and flip, and maintain low level output. Before the rising and falling count switching, the value of ccr1 is set to be greater than the value of arr, the value of ccr1fall is set to a, ccr2 and ccr2fall remain unchanged at 0, the value of ccr3 is set to c, the value of ccr3fall is set to 0, and the values ​​of ccr4 and ccr4fall are both set to 0. When switching, the set value is refreshed to the shadow register, then in the falling count, channel 1 and channel 3 have matching conditions, and the waveforms of oc1ref and oc3ref are output. Channel 2 and channel 4 do not match and keep the low level output. Before the falling and rising count switching of the second cycle, ccr1 and ccr1fall are set to 0, ccr2 is set to b, ccr2fall is set to a value greater than arr, ccr3 is set to 0, ccr3fall is set to c, and ccr4 and ccr4fall are set to 0. When switching, the set value is refreshed to the shadow register, then in the rising count of the second cycle, channel 2 and channel 3 have matching conditions, and the waveforms of oc2ref and oc3ref are output. Channel 1 and channel 4 keep the low level unchanged. Before the next phase change, the values ​​of ccr1 and ccr1fall remain at 0, the value of ccr2 is set to a value greater than arr, the value of ccr2fall is set to b, the values ​​of ccr3 and ccr3fall are both set to 0, the value of ccr4 is set to d, and the value of ccr4fall is set to 0. During the rising and falling commutation of the second counting cycle, the set value is refreshed to the shadow register. After the commutation, channel 2 and channel 4 generate matching conditions, and the waveforms of oc2ref and oc3ref are output. Channel 1 and channel 3 will remain at a low level output. Before entering the third counting cycle, reset to the initial value of this method. Repeating the above steps, 4 sets of output waveforms with an actual cycle of 2 counting cycles can be obtained, thus realizing the cross-cycle waveform output spanning a PWM counting cycle.In this embodiment, by flexibly selecting the trigger conditions of ccrx and ccrxfall, the output periods of the four groups of waveforms span one PWM counting period, realizing phase orthogonal waveforms with cross-period output. For example, the actual periods of the four groups of waveforms are two PWM counting periods.

[0038] Please refer to Figure 5 , which shows a schematic diagram of another timer-related waveform provided by an embodiment of the present application. Figure 5 The output waveforms of each channel in Figure 5 are the output results of the above signal modulation method. In

[0039] , 0 < d < c < b < a < arr, the timer includes a first channel, a second channel, a third channel, and a fourth channel. The comparison result in the first channel is the first comparison result, the comparison result in the second channel is the second comparison result, the comparison result in the third channel is the third comparison result, and the comparison result in the fourth channel is the fourth comparison result; the output circuit receives the first comparison result, the second comparison result, the third comparison result, and the fourth comparison result, and outputs the output waveform of the first channel, the output waveform of the second channel, the output waveform of the third channel, and the output waveform of the fourth channel; wherein, the first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to the second phase difference between the output waveform of the second channel and the output waveform of the fourth channel.

[0040] From the above embodiments, it can be seen that the first threshold and the second threshold of each channel are adjustable. When the count value is in an upward trend, the first threshold of each channel is less than or equal to the second threshold. When the count value is in a downward trend, the first threshold of each channel is greater than or equal to the second threshold. That is to say, when the count value is in an upward trend, make the value of ccrxfall greater than the value of ccrx, and when the count value is in a downward trend, make the value of ccrx greater than the value of ccrxfall.

[0041] The two signal modulation methods disclosed above are only examples for illustrating the usage method of the signal modulation circuit disclosed in the present application. In fact, based on the signal modulation circuit disclosed in the present application (see Figure 3), the steps and parameters of the signal modulation method can be flexibly set to achieve different timer output waveforms and improve the flexibility of the output waveform. In general, the signal modulation circuit disclosed in the present application can make the timer output waveform more flexible by resetting the relevant comparison threshold before the timer count flips, so as to meet more user needs. By controlling the comparison trigger points of the rising increment count and the falling decrement count, the limitation of the prior art that only one PWM count cycle can be output with the counter reversal point as the center position is broken, and the waveform output with the same side flipping within half a cycle and the cross-cycle waveform output spanning a PWM count cycle are realized.

[0042] Based on similar technical concepts, the present application discloses a motor driving device, including the signal modulation circuit disclosed in the above embodiments.

[0043] Exemplarily, the motor drive device includes motor applications such as high-speed blowers and power management. Since the timer in the motor drive device is optimized, the motor drive device can achieve more functions compared to the prior art and meet customized requirements.

[0044] It should be noted that the uppercase and lowercase letters in the above application documents have the same meaning. For example, CCR1 and ccr1 both represent the capture / compare register group of the first channel of the timer.

[0045] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments. In addition, the above embodiments can be freely combined as needed.

Claims

1. A signal modulation circuit, It is characterized in that For a timer, the timer includes at least one channel, and the signal modulation circuit includes: a comparison circuit, a control circuit and an output circuit; wherein, The comparison circuit is configured to compare the count value of the timer with the first threshold and the second threshold of each channel based on the control signal, and output the comparison result to the output circuit; wherein the first threshold and the second threshold of each channel are adjustable, when the count value is in an upward trend, the first threshold of each channel is less than or equal to the second threshold, and when the count value is in a downward trend, the first threshold of each channel is greater than or equal to the second threshold; The control circuit is configured to generate the control signal and output the control signal to the comparison circuit and the output circuit, wherein the control signal is used to select and turn on the multiplexers in the comparison circuit and the output circuit; The output circuit is configured to receive the comparison result and output a modulated signal based on the control signal.

2. The signal modulation circuit according to claim 1, It is characterized in that The counting mode of the timer is a center alignment mode; In a counting cycle, the time during which the count value is in an upward trend is equal to the time during which the count value is in a downward trend, and the process during which the count value reaches a maximum value from a minimum value or reaches a minimum value from a maximum value is half a counting cycle.

3. The signal modulation circuit according to claim 2, It is characterized in that The at least one channel includes a first channel, and a result of the comparison in the first channel is a first comparison result; The output circuit receives the first comparison result so that the output waveform of the first channel is reversed in the half counting cycle.

4. The signal modulation circuit according to claim 3, It is characterized in that The at least one channel further comprises a second channel, a third channel and a fourth channel, the comparison result in the second channel is a second comparison result, the comparison result in the third channel is a third comparison result, and the comparison result in the fourth channel is a fourth comparison result; The output circuit receives the second comparison result, the third comparison result and the fourth comparison result, so that the output waveform of the second channel, the output waveform of the third channel and the output waveform of the fourth channel are flipped in the half counting cycle; The first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to the second phase difference between the output waveform of the second channel and the output waveform of the fourth channel.

5. The signal modulation circuit according to claim 4, It is characterized in that The first phase difference and the second phase difference are 180 degrees, and the output waveforms of each channel are in the same counting cycle.

6. The signal modulation circuit according to claim 2, It is characterized in that The at least one channel includes a first channel, a second channel, a third channel and a fourth channel, the result of comparison in the first channel is a first comparison result, the result of comparison in the second channel is a second comparison result, the result of comparison in the third channel is a third comparison result, and the result of comparison in the fourth channel is a fourth comparison result; The output circuit receives the first comparison result, the second comparison result, the third comparison result and the fourth comparison result, and outputs an output waveform of the first channel, an output waveform of the second channel, an output waveform of the third channel and an output waveform of the fourth channel; The first phase difference between the output waveform of the first channel and the output waveform of the third channel is equal to the second phase difference between the output waveform of the second channel and the output waveform of the fourth channel.

7. The signal modulation circuit according to claim 6, It is characterized in that The first phase difference and the second phase difference are 180 degrees, and an output waveform group consisting of output waveforms of each channel in one cycle spans two adjacent counting cycles.

8. The signal modulation circuit according to claim 1, It is characterized in that The control signal includes a first signal and a second signal, and the first signal and the second signal enable the count value to be compared with a first threshold value and a second threshold value of each channel when the count value is in an upward trend or a downward trend.

9. The signal modulation circuit according to claim 1, It is characterized in that The control circuit is further configured to generate a third signal, wherein the third signal is used to adjust the first threshold and the second threshold of each of the channels when the count value changes from an increasing trend to a decreasing trend or from a decreasing trend to an increasing trend.

10. A motor drive device, It is characterized in that The method comprises the signal modulation circuit as claimed in any one of claims 1 to 9.