Share this

Research and Design of Stepper Motor Controller Based on GAL Device

2026-04-06 07:20:34 · · #1
Stepper motors are widely used in motion control systems with high precision requirements, such as robots, printers, floppy disk drives, plotters, and mechanical valve controllers. Currently, stepper motor control mainly involves ring pulse distributors composed of distributed components, software ring pulse distributors, and dedicated integrated chip ring pulse distributors. Ring pulse distributors composed of distributed components are relatively large, and their reliability is significantly reduced due to the delay of the distributed components; software ring distributors consume host computer runtime, reducing speed; dedicated integrated chip ring pulse distributors have high integration and good reliability, but their adaptability is limited, and they have long development cycles and high costs. Generic Array Logic (GAL) is a new type of electrically erasable programmable PLD device developed by Lattice Systems, Inc. in the United States. In recent years, GAL has gained the trust of many users due to its high performance, high reliability, erasability, configurable output logic structure, and 100% yield rate. It can be used to construct decoders, priority encoders, multiplexers, comparators, shift registers, counters, bus arbiters, etc. Using GAL devices to control a three-phase stepper motor not only simplifies the system structure and reduces costs, but also provides flexible and convenient programming, improves system reliability, and enhances system adaptability. 1. Three-Phase Six-Step Stepper Motor Control Requirements Torque-angle characteristics are a crucial parameter for stepper motor operation. Good torque-angle characteristics result in higher starting torque and less step loss. Improving torque-angle characteristics is generally achieved by increasing the number of steps in the stepper motor's operation. Three-phase six-step operation has twice the torque-angle characteristics of three-phase two-step operation; therefore, in many cases, three-phase stepper motors adopt this mode. When a three-phase stepper motor operates in three-phase six-step mode, each state change causes the motor to rotate 1/6 of the tooth pitch. The three-phase excitation pattern is A-AB-B-BC-C-CA, a total of six steps, as shown in Figure 1. A, B, and C represent the drive pulses connected to the A-phase, B-phase, and C-phase windings of the three-phase stepper motor, respectively. Typically, stepper motor pulse control is implemented using logic circuits. In computer-controlled systems, the operating mode, direction, and speed of the motor can also be determined by programming and outputting pulses from the extended I/O port. This method has a simple circuit and flexible control, but it occupies too much CPU time, and the PC must be occupied every time the motor is driven. This paper uses the GAL16V8 programmable logic device (PLD) to design the logic circuit. Here, three control signals are selected: (1) start control signal S, when S=1 it is stop, and S=0 it is start; (2) forward and reverse control signal D, when D=1 the motor rotates forward, and when D=0 the motor rotates in reverse; (3) speed switching signals R and C, when R=0 and C=0 the frequency is fck; when R=1 and C=1 the frequency is fck/2. The speed of the stepper motor is usually controlled by changing the frequency of the timing pulse, so the frequency is used to represent the change of speed. Since the clocks of all flip-flops of the GAL device are connected together, two or more clock frequencies cannot be introduced at the same time. Therefore, we start by modifying the combinational logic part to achieve frequency division control of the motor speed. Similarly, four-phase eight-step, five-phase ten-step, and six-phase twelve-step stepper motor control can also be achieved, which is more powerful than dedicated integrated circuits. 2. Logic Design for GAL Control Pulse Distribution If integrated circuit chips are used to control a three-phase six-step stepper motor, more components are required, and the circuit is generally more complex. To meet the frequency division requirement of the motor speed, under the same clock frequency control, a D-type flip-flop must be used, with C participating in combinational logic. Its logic circuit is shown in Figure 2. CK is the control signal, and the outputs O, P, and Q of the three D-type flip-flops are connected to the three windings of the stepper motor, respectively. According to the number of driving phases of the stepper motor and the control requirements, there must be corresponding delay flip-flops to maintain the transition between the current state and the next state. This can be accomplished using three of the eight output logic macrocells in the GAL. The current state of the motor's operating state (O, P, Q) and the control signals (S, R, D) can be controlled through the AND and OR array combinational logic of the GAL. 2.1 Logic Control State Table According to the motor's excitation law, under the action of timing pulses, the state of the timing circuit will cycle through six states, driving the motor to operate. Here, a, b, c, d, e, and f represent its six states, namely a=100, b=110, c=010, d=011, e=001, and f=101. The state table can be obtained from the logic circuit diagram, as shown in Table 1. 2.2 State Truth Table The state truth table can be obtained from Table 1, as shown in Table 2. In the table, the O, P, and Q states change under the control of clock pulses, determining the motor's start-up, direction, and speed under the control of the control variables. 2.3 Karnaugh Map In the Karnaugh map, input variables are represented in two rows, and the order of variable values ​​follows the cyclic code. This arrangement ensures that the minterms represented by two geometrically adjacent small squares in the Karnaugh map differ by only one variable. This is the basis for simplifying logic functions using Karnaugh maps. For multivariate inputs, the following points should be noted when using Karnaugh maps: (1) Circle all adjacent phases with a value of 1 according to the principle of "minimum and maximum" (i.e., the minimum number of circles and the maximum number of minterms in the circle). (2) The terms at the four corners and the two opposite sides of the Karnaugh map are also adjacent, and the symmetrical terms in the upper, lower, or left and right parts of the Karnaugh map are also adjacent. (3) Each rectangular circle must contain at least one minterm that has not appeared in other circles, otherwise there will be repetition and the simplified formula cannot be obtained. (4) Each small square with a value of "1" can be circled multiple times, but it cannot be omitted. The minimum circle can contain only one small square, that is, it cannot be simplified. Taking O as an example, its Karnaugh map can be obtained from the state truth table, as shown in Figure 3. Based on the number of revolutions and minterms, its logical expression can be obtained as follows: Similarly, the logical expressions for P and Q can also be obtained. 3 GAL Software Design 3.1 GAL Device Selection and Pin Variable Allocation There are various models of GAL devices. According to the design requirements and from an economic perspective, GAL16V8 is selected to implement the control of a three-phase six-step stepper motor. 3.2 GAL Source File Design According to the control requirements and programming format, the source file for the obtained timing logic equations is as follows: No need to add during actual input. Comment lines start with ";". Input the above source file into the computer, and then compile or assemble the file to generate JEDEC files, pin configuration diagrams, fuse diagrams, etc. Use a programmer to program the GAL device. After programming, the programmer also has the function of automatically checking all the memory units of the programming chip. 4 System Hardware Connection The circuit schematic is shown in Figure 4. The left side is the pin diagram of the GAL16V8 chip. S, D, and R determine the motor's start, direction, and speed, respectively. Outputs O, P, and Q are connected to the motor's A, B, and C coils, respectively. The diagram only shows the drive circuit for one coil. Note: Unused pins of GAL components should be directly grounded or connected to the power supply; leaving them floating will increase power consumption and reduce interference immunity. This stepper motor controller, mainly composed of GAL16V8 chips, is used for the automatic control of three-phase six-step stepper motors. It can be used independently to drive objects or run under microcomputer management without consuming CPU time. Complex timing circuits can be implemented with a single GAL chip, reducing the size of the system. Computer-aided design greatly accelerates the design process, reduces errors, lowers costs, improves system reliability and stability, and allows for repeated modification and programming, offering exceptional flexibility.
Read next

CATDOLL 135CM Vivian

Crafted with attention to detail, this 135cm doll offers a well-balanced and realistic body shape that feels natural in...

Articles 2026-02-22