
At the same time, it also generates a sampling period, that is, the Anzhao sampling period starts A/D conversion. The PWM speed controller uses the timer 0 interrupt mode to generate PWM pulse, and the PWM control subroutine is the interrupt service routine of timer 0.
#L298n motor driver power requirements software#
In terms of program design, the generation of the PWM pulse signal of the MCU can use the following two methods: software delay and timer delay.Īlthough software delay is easier to implement, in theory, it occupies too much system resources and is inconvenient to use. V Software Implementation of PWM Speed Regulation The speed of the motor is realized by adjusting the duty ratio of the PWM signal by the single-chip microcomputer. When it is low level, the 4 transistors on the drive bridge are all cut off, so that the armature current of the running motor is reversed and the motor stops freely.

For the PWM signal, the input terminal In2 is low level, the motor rotates forward the input terminal In2 is the PWM signal, input terminal In1 is recorded as low level, the motor reverses). Hardware composition diagram of PWM speed controllerĪccording to the input and output relationship of L298, the enable control terminal EnA is connected to the P1.0 port of the AT89C52. The internal structure of L298 is shown in Figure 3.įigure 3. There are two identical PWM power amplifier circuits inside. Its driving voltage can reach 46V, and the total DC current can reach 4A. It can be used to drive inductive loads such as relays, coils, DC motors, and stepping motors. L298 is a dual H-bridge high-voltage high-current power integrated circuit, which directly uses ITL logic level control. At present, the control of DC motors is mainly based on the application of PWM control. This serious shortcoming makes PFM control unsuitable in servo systems. Since PFM control relies on the pulse frequency to change the duty cycle, when it encounters a mechanical resonance at a particular frequency, it often results in system vibration and audio whistling. Another way is to have a constant turn-on pulse width and change the duty cycle by changing the switching frequency (f=1/T).One is that the switching period is constant, and the duty cycle is changed by changing the on-pulse width.

There are two modulation methods for changing the duty cycle: The average voltage across the motor also changes accordingly. It can be seen from the above formula that changing the ratio of the switch-on time ton to the switching period T, that is, changing the duty cycle of the pulse.

Good linear speed regulation characteristics.V Software Implementation of PWM Speed Regulationįor a long time, because DC motors have the following characteristics:
