method and device for improving precision of PWM controller

文档序号:1711614 发布日期:2019-12-13 浏览:27次 中文

阅读说明:本技术 一种提高pwm控制器精度的方法及装置 (method and device for improving precision of PWM controller ) 是由 不公告发明人 于 2019-08-16 设计创作,主要内容包括:本发明适用于PWM控制器技术领域,尤其涉及一种提高PWM控制器精度的方法及装置,方法包括:设定扩展修正参数值;多次进入PWM中断,根据扩展修正参数值将已达周期扩展为预达周期,并基于预达计数计算预达周期中的脉冲宽度;以及当PWM中断的次数达到扩展修正参数值的整数倍时,将脉冲宽度分配到预达周期中。即使预达计数大于原PWM控制器的计数精度范围,经过重新分配脉冲宽度,能够避免受到硬件的限制,实现与预达计数相匹配的功能,大大提高了PWM控制器的精度。(The invention is suitable for the technical field of PWM controllers, and particularly relates to a method and a device for improving the precision of a PWM controller, wherein the method comprises the following steps: setting an extension correction parameter value; entering PWM interruption for multiple times, expanding the reached period into a preset period according to the expansion correction parameter value, and calculating the pulse width in the preset period based on the preset count; and distributing the pulse width into the expected period when the number of PWM interruptions reaches an integer multiple of the value of the extended correction parameter. Even if the count of the predicted number is larger than the count precision range of the original PWM controller, the pulse width is redistributed, so that the limitation of hardware can be avoided, the function matched with the predicted number is realized, and the precision of the PWM controller is greatly improved.)

1. a method for improving accuracy of a PWM controller, the method comprising:

setting an extension correction parameter value;

entering PWM interruption for multiple times, expanding the reached period into a preset period according to the expansion correction parameter value, and calculating the pulse width in the preset period based on the preset count; and

When the number of PWM interruptions reaches an integer multiple of the value of the extended correction parameter, the pulse width is allocated to the expected period.

2. The method for improving the accuracy of the PWM controller according to claim 1, wherein the step of calculating the pulse width in the expected period based on the expected count specifically comprises:

dividing the pre-reached count by the value of the spread correction parameter to obtain a pulse width and a remainder;

The remainder is apportioned among the respective reached-period pulse widths.

3. The method of claim 2, wherein the step of apportioning the remainder into the pulse widths for each of the reached periods, comprises:

And judging whether the remainder is completely shared or not when the PWM interruption is started every time, judging that the remainder is not completely shared if the remainder is larger than zero, continuously sharing the remainder by modifying the pulse width, and updating the shared remainder.

4. the method of claim 3, wherein the step of extending the reached period to the expected period according to the extended correction parameter value comprises:

setting the period of the PWM controller as a reached period;

and counting the reached period, judging whether the count value reaches the integral multiple of the expansion correction value, and if so, judging that the reached period is expanded into the expected period.

5. the method for improving the accuracy of the PWM controller according to any one of claims 1 to 4, wherein the step of setting the values of the extended correction parameters specifically comprises:

and dividing the counting range corresponding to the PWM controller with the achieved precision by the counting range corresponding to the PWM controller with the achieved precision to obtain the set extended correction parameter value.

6. An apparatus for improving the accuracy of a PWM controller, the apparatus comprising:

A setting unit for setting an extended correction parameter value;

The calculation unit is used for entering PWM interruption for multiple times, expanding the reached period into a preset period according to the expansion correction parameter value and calculating the pulse width in the preset period based on the preset count; and

and the distribution unit is used for distributing the pulse width into the expected period when the number of times of PWM interruption reaches the integral multiple of the value of the extended correction parameter.

7. An apparatus for improving accuracy of a PWM controller according to claim 6, wherein the calculating unit comprises:

A first calculating unit for dividing the pre-arrival count by the value of the spread correction parameter to obtain a pulse width and a remainder;

and the apportionment unit is used for apportioning the remainder into the pulse width of each reached period.

8. the apparatus for improving the accuracy of a PWM controller according to claim 7, wherein the apportioning unit comprises:

And the remainder sharing unit is used for judging whether the remainder is shared or not when the PWM interruption is started every time, judging whether the remainder is not shared completely if the remainder is larger than zero, continuously sharing the remainder by modifying the pulse width, and updating the shared remainder.

9. an apparatus for improving accuracy of a PWM controller according to claim 8, wherein the calculating unit comprises:

The preset unit is used for setting the period of the PWM controller to be the reached period;

And the judging unit is used for counting the reached period, judging whether the count value reaches the integral multiple of the expansion correction value, and if so, judging that the reached period is expanded into the expected period.

10. An apparatus for improving accuracy of a PWM controller according to any one of claims 6 to 9, wherein the setting unit comprises:

and the second calculation unit is used for dividing the counting range corresponding to the PWM controller with the accuracy achieved by the counting range corresponding to the PWM controller with the accuracy achieved to obtain the set extended correction parameter value.

Technical Field

The invention is suitable for the technical field of PWM controllers, and particularly relates to a method and a device for improving the precision of a PWM controller.

Background

Pulse Width Modulation (PWM) is a very effective technique for controlling analog circuits by using digital outputs of microprocessors, and is widely used in many fields from measurement, communication, power control and conversion.

The pulse width modulation is an analog control mode, and modulates the bias of a transistor base or a MOS tube grid according to the change of corresponding load to realize the change of the conduction time of the transistor or the MOS tube, thereby realizing the change of the output of the switching voltage-stabilized power supply. This way the output voltage of the power supply can be kept constant when the operating conditions change, which is a very effective technique for controlling an analog circuit by means of the digital signal of the microprocessor.

However, the accuracy of the conventional pulse width modulation is often set only by factory settings. For example, a PWM controller with 8-bit accuracy has a theoretical resolution of 1/256, and to achieve this resolution, T/C needs to count from 0 to 255; and the theoretical resolution of the PWM controller with 16 bits precision is 1/65536, and to achieve this resolution, T/C needs to be counted from 0 to 65535, and obviously the PWM controller with 8 bits precision cannot realize the corresponding function with 10 bits or 16 bits precision. Then operating personnel can receive because the limitation that the precision brought, can't realize the operation of higher accuracy in the use, brings very big inconvenience for operating personnel.

disclosure of Invention

The embodiment of the invention provides a method and a device for improving the precision of a PWM (pulse-width modulation) controller, aiming at solving the problems that the precision of the PWM controller is fixed and higher precision cannot be realized.

The embodiment of the invention is realized in such a way that the invention provides a method for improving the precision of a PWM controller, which comprises the following steps: setting an extension correction parameter value; entering PWM interruption for multiple times, expanding the reached period into a preset period according to the expansion correction parameter value, and calculating the pulse width in the preset period based on the preset count; and distributing the pulse width into the expected period when the number of PWM interruptions reaches an integer multiple of the value of the extended correction parameter.

further, the step of calculating the pulse width in the expected period based on the expected count specifically includes: dividing the pre-reached count by the value of the spread correction parameter to obtain a pulse width and a remainder; the remainder is apportioned among the respective reached-period pulse widths.

further, the step of distributing the remainder to the pulse width of each reached period specifically includes: and judging whether the remainder is completely shared or not when the PWM interruption is started every time, judging that the remainder is not completely shared if the remainder is larger than zero, continuously sharing the remainder by modifying the pulse width, and updating the shared remainder.

Further, the step of expanding the reached period to the expected period according to the expanded corrected parameter value specifically includes: setting the period of the PWM controller as a reached period; and counting the reached period, judging whether the count value reaches the integral multiple of the expansion correction value, and if so, judging that the reached period is expanded into the expected period.

Further, the step of setting the extended correction parameter value specifically includes: and dividing the counting range corresponding to the PWM controller with the achieved precision by the counting range corresponding to the PWM controller with the achieved precision to obtain the set extended correction parameter value.

The present invention also provides an apparatus for improving the accuracy of a PWM controller, the apparatus comprising: a setting unit for setting an extended correction parameter value; the calculation unit is used for entering PWM interruption for multiple times, expanding the reached period into a preset period according to the expansion correction parameter value and calculating the pulse width in the preset period based on the preset count; and a distribution unit for distributing the pulse width into the expected period when the number of PWM interruptions reaches an integral multiple of the value of the extended correction parameter.

still further, the calculation unit includes: a first calculating unit for dividing the pre-arrival count by the value of the spread correction parameter to obtain a pulse width and a remainder; and the apportionment unit is used for apportioning the remainder into the pulse width of each reached period.

Still further, the apportioning unit includes: and the remainder sharing unit is used for judging whether the remainder is shared or not when the PWM interruption is started every time, judging whether the remainder is not shared completely if the remainder is larger than zero, continuously sharing the remainder by modifying the pulse width, and updating the shared remainder.

Still further, the calculation unit includes: the preset unit is used for setting the period of the PWM controller to be the reached period; and the judging unit is used for counting the reached period, judging whether the count value reaches the integral multiple of the expansion correction value, and if so, judging that the reached period is expanded into the expected period.

Still further, the setting unit includes: and the second calculation unit is used for dividing the counting range corresponding to the PWM controller with the accuracy achieved by the counting range corresponding to the PWM controller with the accuracy achieved to obtain the set extended correction parameter value.

The invention has the advantages that compared with the prior art, the invention designs the method and the device for improving the precision of the PWM controller, firstly, the invention sets the extended correction parameter value, carries out period extension according to the extended correction parameter value after entering PWM interruption for a plurality of times, extends the smaller reached period into the larger reached period, redistributes the pulse width in the reached period according to the reached count, distributes the redistributed pulse width to the reached period when the number of times of PWM interruption reaches the integral multiple of the extended correction parameter value, even if the reached count is larger than the counting precision range of the original PWM controller, the invention can avoid the limitation of hardware by redistributing the pulse width, realizes the function matched with the reached count, and greatly improves the precision of the PWM controller.

drawings

Fig. 1 is a block flow diagram of a method for improving the accuracy of a PWM controller according to an embodiment of the present invention;

FIG. 2 is a block diagram of a process for calculating pulse width according to a second embodiment of the present invention;

FIG. 3 is a block diagram of the process of apportioning the remainder to the pulse width according to the third embodiment of the present invention;

FIG. 4 is a block diagram of a flow chart for extending an reached period to a predicted period according to a fourth embodiment of the present invention;

FIG. 5 is a block diagram of a flow chart for clearing the flag according to a fifth embodiment of the present invention;

fig. 6 is a block diagram of a flowchart of setting an extended correction parameter value according to a sixth embodiment of the present invention;

FIG. 7 is a waveform comparison chart before and after the accuracy improvement provided by the embodiments of the present invention;

FIG. 8 is a flowchart illustrating the overall method for improving the accuracy of the PWM controller according to an embodiment of the present invention;

Fig. 9 is a block diagram of an apparatus for improving the accuracy of a PWM controller according to a seventh embodiment of the present invention;

Fig. 10 is a first block diagram of a computing unit according to an eighth embodiment of the present invention;

FIG. 11 is a block diagram illustrating a remainder apportioning unit according to a ninth embodiment of the present invention;

fig. 12 is a second block diagram of a computing unit according to a tenth embodiment of the present invention;

fig. 13 is a third structural block diagram of a computing unit according to an eleventh embodiment of the present invention;

fig. 14 is a block diagram of a setting unit according to a twelfth embodiment of the present invention.

Detailed Description

in order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

The invention designs a method and a device for improving the precision of a PWM controller, which firstly sets an extension correction parameter value, carries out period extension according to the extension correction parameter value after entering PWM interruption for a plurality of times, extends a smaller reached period into a larger reached period, redistributes pulse width in the reached period according to the reached count, distributes the redistributed pulse width to the reached period when the number of times of PWM interruption reaches integral multiple of the extension correction parameter value, even if the reached count is larger than the counting precision range of the original PWM controller, can avoid the limitation of hardware by redistributing the pulse width, realizes the function matched with the reached count, and greatly improves the precision of the PWM controller.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:应用于集成磁隔离芯片的边沿转换方法及编解码电路

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!