The hottest step motor driver based on L297 and L2

  • Detail

Design of stepping motor driver based on L297 and L298

stepping motor is widely used in motion control with high accuracy requirements. Instead, it selects industrial control computer systems, such as robots, printers, floppy disk drives, plotters, mechanical valve controllers, etc. At present, the control of stepping motor mainly includes ring pulse distributor composed of dispersed devices, software ring pulse distributor, special integrated chip ring pulse distributor, etc. The volume of the annular pulse distributor composed of dispersed devices is relatively large, and its reliability is greatly reduced due to the delay of dispersed devices; The software ring distributor takes up the running time of the host and reduces the speed; The special integrated chip ring pulse distributor has high integration and good reliability, but its adaptability is limited. At the same time, the development cycle is long and the demand cost is high

stepper motor control

stepper motor is a digital control motor, which converts the pulse signal into angular displacement, that is, when a pulse signal is given, the stepper motor rotates an angle, and it can also be used as a cold source (heat source) to guide the liquid in the tank outward, so it is very suitable for single-chip microcomputer control. Stepping motor can be divided into reactive stepping motor (VR), permanent magnet stepping motor (PM) and hybrid stepping motor (HB). The biggest feature of stepper motor different from other control motors is that it is controlled by inputting pulse signals, that is, the total rotation angle of the motor is determined by the number of input pulses, and the speed of the motor is determined by the frequency of pulse signals. The driving circuit of the stepping motor works according to the control signal, which is generated by the single chip microcomputer. Its basic principle and function are as follows:

(1) control the commutation sequence, and the process of power on commutation is called pulse distribution. For example, in the working mode of hybrid stepping motor, the power on sequence is a-b-c-d. the power on control pulse must strictly follow this sequence to control the on-off of phase a, B, C and D respectively, which is the so-called pulse ring distributor

(2) control the steering of the stepping motor. If the given working mode is switched on in positive sequence, the stepping motor will turn forward. If it is switched on in reverse sequence, the motor will reverse

(3) control the speed of the stepping motor. If a control pulse is sent to the stepping motor, it will turn one step. If another pulse is sent, it will turn another step. The shorter the interval between the two pulses, the faster the stepping motor rotates

Step motor drive circuit composed of L297 and L298

l297 single chip step motor control IC of SGS company is applicable to the control of bipolar two-phase step motor or four phase unipolar step motor. It is combined with two H-bridge drive chips L298 to form a complete PWM constant current chopper driver with fixed chopper frequency for step motor

l297 generates four phase drive signals to control bipolar two-phase stepping motor or four phase monopolar stepping motor. Three working modes of half step, two-phase excitation and single-phase excitation can be used to control the stepping motor, and the on-chip PWM chopper circuit that controls the motor allows the switching of three working modes. The outstanding feature of using L297 is that it only needs three external input signals: clock, direction and working mode. At the same time, L297 automatically generates motor excitation phase sequence, which reduces the burden of microprocessor control and programming. L297 has two packaging forms of dip20 and so20, which can be used to control the integrated bridge drive circuit or the drive circuit composed of discrete components

l297 is mainly composed of decoder, two PWM constant current choppers with fixed chopping frequency and output logic control. Its internal structure is shown in Figure 1

Figure 1 internal structure block diagram of L297

another important component of L297 is that PWM chopper controls phase winding current to realize constant current chopping control, so as to obtain good torque frequency characteristics. Each chopper is composed of a comparator, an RS trigger and an external sampling resistor (see Figure 2). A common oscillator is set inside to provide trigger pulse signals to the two choppers. The pulse frequency is determined by the external RC network. At that time, the oscillator pulse sets the trigger to "1", the phase current of the motor winding rises, and when the voltage of the sampling resistor RS rises to the reference voltage Vref, the comparator flips over to reset the trigger, The power transistor turns off and the current drops, waiting for the arrival of the next oscillator pulse. In this way, the trigger output is a constant frequency PWM signal, modulating the output signal of L297, and the peak value of winding phase current is determined by VREF

control signal is used to select chopper signal control. When it is low level, the chopper signal acts on the two forbidden signals, and when it is high level, the chopper signal acts on the A, B, C and D signals. The former is applicable to the unipolar working mode, while for the motor with bipolar working mode, these two control modes can be adopted

Figure 2 chopper circuit

multiple L297 can work synchronously by using the sync pin of L297. Its connection mode is shown in Figure 3. Only RC is connected to one chip, while the OSC pins of other chips are grounded, which can avoid the introduction of grounding clutter

Figure 3 multiple L297 work synchronously

the L298 chip of SGS company is a high-voltage, high current dual H-bridge power integrated circuit, which can be used to drive inductive loads such as relays, coils, DC motors and stepper motors. It has two suppressed inputs to make the device unaffected by the input signal. The emitter stages of the triode of each bridge are connected together, and the corresponding external terminal can be used to connect the peripheral sensing resistance. Another input power supply can be placed so that the logic can work under low voltage

the stepping motor drive circuit realized by L297 and L298 is shown in Figure 4. This circuit is a PWM constant current chopper drive mode with fixed chopper frequency, which is suitable for two-phase bipolar stepping motors. The maximum voltage is 46v, and the current of each phase can reach 2A. There are electronic and electro-hydraulic stepping motors with simple structure. Two pieces of L298 and one piece of 297 can be used together to drive two-phase stepping motors with higher power

Figure 4 stepping motor drive circuit diagram of L297 and L298

software design

when the program enters the non program area, as long as the interception measures are set in the non program area to make the program enter the trap, and then force the program to return to the initial state. If the byte code corresponding to the rst instruction of the CPU is 0ffh, if the unused program storage area is written with 0ffh in advance, when the program "flies" to the area due to interference to execute the code, it is equivalent to executing an RST instruction, so as to achieve the purpose of system reset

use C language to write program code

po_ 0=1;//CW direction

po_ 1=1;//Half step

po_ 3=1;//Enable enable

po_ 2=1;//Reset reset

po_ 7=1;//Clock clock

tmod=o x O1//Ti adopts timer

tho= (I 4000/256)

tlo= one ()

tro II



tho= one (the test result of 400 non-standard state should consider that this factor is reflected in the design 0/256);

tlo= one (4000% 256);

do{}while (! TFO)

PO_ 7=! PO_ 7; Clock output clock




the stepper motor drive system with this design can drive two-phase or four phase hybrid stepper motors with stable motion, fast speed, low noise, high control precision, and can be driven in full step and half step. The appearance adopts aluminum magnesium alloy, which has good heat dissipation and low price. It can be widely used in systems that need hybrid two-phase or four phase stepping motors with driving current less than 2A. (end)

Copyright © 2011 JIN SHI