A kind of pulse width modulation apparatus with amplitude limit and method
Technical field
The invention belongs to machine field, be specifically related to a kind of pulse width modulation apparatus with amplitude limit and method.
Background technology
In motor application, the information that can use the electric current of the motor coil of flowing through to provide, estimates motor position, and then according to demand the speed of motor is adjusted.The ishunt value that system gathers according to sampled point, calculates the dutyfactor value that needs adjustment.In application-specific, dutyfactor value need to be subject to the restriction of actual application environment, causes this dutycycle after specific calculating, just can deliver to the output that hardware module removes to realize waveform
Software systems, according to the phase current values collecting at every turn, when calculating the dutycycle in next pwm cycle, need to consider that limiting it is not more than periodic quantity, must not be less than skip distance etc. factor.These factors that need to consider are fixed under certain environment simultaneously, in the conventional method, all need software to carry out identical calculating at every turn.
Realizing in technology of pwm module, hardware need to produce three pairs with the complementary signal at certain hour interval, hardware has a counter first upwards to count down to a definite value and then counts down to 0 downwards, hardware logic can be during counter be greater than the value of fiducial value register configuration, export a high level, a low level of all the other time outputs, finally according to this waveform, be divided into two again, produce an a pair of complementary signal with Dead Time interval, as the T1 of Fig. 4 and T1_n, all the other two pairs of signals in like manner draw.In common system applies, different according to applied environment, may need the dutycycle of configuration to limit, such as limiting it, needs are not more than periodic quantity, must not be less than skip distance etc., all need in the conventional method software through same calculating at every turn, just can draw a final dutyfactor value, this has increased the burden of software systems undoubtedly.
Summary of the invention
The present invention is directed to the problems referred to above, a kind of pulse width modulation apparatus with amplitude limit and method are provided.By software, when the initialization, configure limit register limit_high and the limit_low of a pair of dutycycle.Once the value that system initial calculation goes out is the limited range that duty register exceeds these two values, it is that limit_high register value or minimum limit value are limit_low register value that pulse width modulation apparatus is adjusted to dutyfactor value maximum automatically, alleviate software systems burden, improve service efficiency.
The present invention addresses the above problem adopted technical scheme: a kind of pulse width modulation apparatus with amplitude limit, comprising: limit_high register, limit_low register, duty register, period register and counter module; Described limit_high register, limit_low register and duty register are connected counter module; Described period register connects counter module.
Further, a kind of pulse duration modulation method with amplitude limit, comprises the following steps: software, when initialization, configures limit register limt_high and the limit_low of a pair of dutycycle.Once the value that system initial calculation goes out is the limited range that duty register exceeds these two values, with the pulse width modulation apparatus of amplitude limit, automatically dutyfactor value is adjusted to maximum limit_high register value or minimum limit value limit_low register value, alleviate software systems burden, improve service efficiency.
Advantage of the present invention is: software, when initialization, configures limit register limit_high and the limit_low of a pair of dutycycle.Once the value that system initial calculation goes out is the limited range that duty register exceeds these two values, it is that limit_high register value or minimum limit value are limit_low register value that hardware module is adjusted to dutyfactor value maximum automatically, do not need a large amount of computation process, alleviate software systems burden, improve service efficiency.
Except object described above, feature and advantage, the present invention also has other object, feature and advantage.Below with reference to figure, the present invention is further detailed explanation.
Accompanying drawing explanation
The accompanying drawing that forms the application's a part is used to provide a further understanding of the present invention, and schematic description and description of the present invention is used for explaining the present invention, does not form inappropriate limitation of the present invention.
In the accompanying drawings:
Fig. 1 is the pulse width modulation apparatus inner structure schematic diagram with amplitude limit of the present invention;
Fig. 2 is sequential chart of the present invention;
Fig. 3 is the existing conceptual scheme before the present invention;
Fig. 4 is the prior art sequential chart before the present invention.
Embodiment
Below with reference to the accompanying drawings and in conjunction with the embodiments, describe the present invention in detail.
With reference to figure 1 and Fig. 2, a kind of pulse width modulation apparatus with amplitude limit as depicted in figs. 1 and 2, comprising: limit_high register, limit_low register, duty register, period register and counter module; Described limit_high register, limit_low register and duty register counter module; Described period register connects counter module.
A pulse duration modulation method with amplitude limit, comprises the following steps: software, when initialization, configures limit register limit_high and the limit_low of a pair of dutycycle.Once the value that system initial calculation goes out is the limited range that duty register exceeds these two values, with the pulse width modulation apparatus of amplitude limit, automatically dutyfactor value being adjusted to maximum is that limit_high register value or minimum limit value are limit_low register value, alleviate software systems burden, improve service efficiency.
As shown in Figure 3, in existing scheme, system, according to the electric bridge bus current ishunt gathering, calculates the dutyfactor value that needs adjustment, such as after the dutycycle of the ub of Fig. 2, the original waveform of output should be as shown in the ub of Fig. 2, consider the restriction of other factors such as dead band, the dutycycle finally obtaining is likely identical with periodic quantity, causes the final complete output low level of ub waveform, obviously in as the application of seven segmentations of Fig. 2, be not allow to occur like this.
With reference to figure 2, as shown in Figure 2, in the present invention, need only and go out a pair of dutycycle upper lower limit value according to calculation of parameter such as actual dead band, cycles, hardware can be according to actual conditions, actual duty cycle is limited in to this scope inner, two vertical lines, i.e. dutycycle restriction value, hardware can be limited in initial duty cycle one side immediate with it automatically like this, and final output waveform is as shown in ub2.
The foregoing is only the preferred embodiments of the present invention, the present invention includes but be not limited to this example, the present invention can have various modifications and variations.Within the spirit and principles in the present invention all, any modification of doing, be equal to replacement, improvement etc., within all should being included in protection scope of the present invention.