Research on parallel port control of stepping motor
Release time:2022-02-26 

Stepping motor is widely used in CNC machine tools, medical instruments, instruments and other control equipment. Its rotation runs step by step at a fixed angle. Its main feature is that it has no accumulated error and can achieve 100% accurate control. Therefore, it is widely used in various open-loop control systems. There are many control methods of stepping motor, including integrated independent controller and various control card forms attached to the computer expansion slot. However, for the small system with microcomputer as the core, the existing port resources of microcomputer, especially the parallel port, can be directly used to realize the operation control of stepping motor. This control method, on the one hand, does not need to add additional hardware equipment, saving equipment cost; Second, it does not occupy isa or PCI expansion slot to save computer resources; Third, flexible control and convenient programming make it an ideal choice.

1 basic control principle of stepper motor stepper motor is an actuator that converts electric pulse into angular displacement. Every time a pulse signal is input, the motor will turn a certain angle (some stepper motors can directly output linear displacement, which is called linear motor). Because the reactive stepping motor has high performance price ratio and is widely used, this paper mainly introduces the control principle and parallel port control method of reactive stepping motor.

Taking the single three beat working mode as an example, the structural schematic diagram of the stepper motor is shown in the figure. The basic rotation principle of the stepper motor is: when the power is connected to the state at the wrong tooth, the rotor will rotate to the position with the maximum permeability (or the minimum reluctance) under the action of electromagnetic force, that is, to the state tending to the opposite tooth. Suppose that phase A is energized first (phase B and C are not energized), generate magnetic flux in the direction of axis A-A, and form a closed circuit through the rotor. At this time, poles A and a become the N and S poles of the electromagnet. Under the action of magnetic field, the rotor always tries to turn to the position where the magnetic resistance is small, that is, to the position where the teeth of the rotor align with poles A and a (a); Then B is energized (A and C are not energized), and the rotor rotates clockwise for 30; Then C is energized (A and C are not energized), and its teeth are aligned with C and C 'poles (c).

If power is applied in the order of a *... The motor rotor rotates counterclockwise.

The rotation of stepper motor, that is, the control windings of phase a, phase B and phase C are energized in a specific order, requires a matching driving circuit (as shown in), which is also controlled by the input electric pulse. This electric pulse can be switching value or digital value. In the small computer control system developed by us, This digital quantity is given by the parallel port of the computer. A control electric pulse is output from the parallel port, and the stepping motor takes one step, That is, turn one / step angle ", until it is turned to the corresponding design angle according to the control requirements. Therefore, the stepping motor and its driving circuit are an interconnected whole. The operation performance of the stepping motor is the comprehensive effect formed by the cooperation of the motor and the driving circuit. The rotation angle is controlled by the number of external input electric pulses, which is the basic control principle of the stepping motor.

2 Port definition and setting of parallel port parallel port is the standard interface of general microcomputer. It has 25 cores and can transmit information through 8 data lines at the same time, one byte at a time. It is usually used for printers, plotters and other peripherals that need 8-bit data transmission. The parallel port can be used for data output and data input, which is very suitable for general digital I / O. because the stepper motor has high turning accuracy and works in open-loop control state, the data output function of the parallel port can be used to replace the pulse signal generator in the traditional stepper motor control circuit, A digital pulse sequence is generated by the program-controlled parallel port and sent to the driving circuit of the stepping motor as an electric pulse signal to control the rotation of the stepping motor.

Bit (B1 / B3 / B5) is used for the steering control of the motor. When 0 is set, the motor rotates clockwise, and when 1 is set, it rotates counterclockwise; The low bit (B0 / B2 / B4) is used to provide stepping driving pulse for the motor. The data bit generates a continuous 1 and alternating digital sequence with a certain delay interval. Therefore, the control word for controlling the clockwise rotation of three stepping motors at the same time is 0x15 (1) / 0x00 (0); The control word of three motors rotating counterclockwise at the same time is: 0x3f (1) / 0x2a (the principle block diagram is shown in the figure: the pulse direction motor of the computer parallel port control system, and the port setting of the pulse direction motor parallel port is automatically configured by the computer system setting program. In the initialization process, the parallel port is configured as LPT1 (for a general-purpose microcomputer equipped with a parallel port), Corresponding interrupt resources and different data addresses are allocated. Status address and control address: irq7, data address 0378h, status address 0379h and control address 037ah. The pin allocation of parallel port is shown in Table 1.

Table 1 pin distribution of parallel port pin identification data bit port pin identification data bit port pin identification data bit port pin identification data bit 3 parallel port control method of stepper motor 3.1 schematic diagram of control system the stepper motor control system discussed in this paper is a subsystem of an industrial control project designed by the author. The design requirements of the subsystem are: control 3 stepper motors with parallel port of microcomputer, - 45 + 45 -90\+9 (1) angular rotation. The design adopts the data port of parallel port, that is, with 0378h as the entry address, three pairs of data bits are allocated to three stepper motors for motor control. They are: motor a is allocated B1 / B0 and motor B is allocated 3.2 control program design method and process. According to the characteristics of stepper motors, the following problems need to be solved when using parallel port to control motors : the stepping driving pulse should have a certain width. The miniature stepping motor of American SHAPHON company is used in the project. The motor adopts negative pulse working mode, which has certain requirements for the uniformity of driving pulse, and the pulse width is not less than 5ls. Therefore, in the program design, the method of time delay is used to make the negative pulse width and uniformity of Bo / B2 / B4 output meet the requirements of the motor.

The direction control pulse of the motor has special requirements, that is, when the motor is reversed, it must be carried out after the motor speed reduction stops. Therefore, in the program design, the direction control signal of each commutation is made prior to the step drive signal, so as to ensure that the commutation signal is sent out after the last pulse in the previous direction and before the first pulse in the next direction.

Design of stepping motor control speed up and down curve. Due to the existence of time constant and inertia, the stepping motor must have a speed up and speed down process from start to stop. The design of speed up and speed down is very important. If the design is improper, it will cause problems such as locked rotor, out of step and slow speed up and down of the stepping motor.

The speed-up process consists of sudden jump frequency plus speed-up curve. The speed-down process is opposite. The ideal speed-up curve should be exponential curve. However, according to the motor characteristics and engineering practice test, the system adopts the method of piecewise linear approximation, and designs a constant speed section to maintain high-speed operation when the motor rises to the highest frequency, so as to improve the motor running speed. The acceleration and deceleration control curves are shown in, and FQ is the starting frequency.

Acceleration and deceleration control curve (4) program execution process. The control program meter uses labwaindows / cvi Language and has a simple and convenient program interface- 45 \ + 45 \ - 90 \ + 90) angle control corresponds to four button controls respectively, and is equipped with interface exit button. All operations can be completed by clicking the relevant button, making the control of stepping motor lively and intuitive. The program design of each rotation angle is completely universal. The main process includes: open the operation interface to judge whether this button is selected. If it is selected, read in the port address, assign the initial jump frequency, accelerate the control in the rising section, maintain the constant speed in the middle section, and slow down the control in the falling section. After the stop of the deceleration control, the port is cleared to return to the operation interface. The whole control program has passed the engineering test and practical application, and the operation effect is good. It is believed that this paper can play a certain reference role in the secondary development and application of computer parallel port resources.

Email Consultation
 * Get the latest price? We'll respond as soon as possible(within 12 hours)