A stepper motor is a fully digital electric actuator. In principle, its angular displacement is proportional to the number of drive pulses. Under normal circumstances, stepper motors are characterized by their simplicity, precise motion, and continuous operation without cumulative error, and are therefore widely used in various position control systems. Currently, due to the increasing complexity of the internal mechanical systems of instruments, their movements are often multi-degree-of-freedom, thus requiring the synthesis of motions from multiple stepper motors to achieve various system actions. For example, in the sampling needle shifting system of the semi-automatic biochemical analyzer shown in Figure 1, the system's action execution consists of two parts: first, a stepper motor on the fixed base controls the vertical lifting and lowering of the sampling crossarm; second, a stepper motor on the slider controls the horizontal rotation of the sampling crossarm. The synthesis of these two movements achieves the position change of the sampling crossarm. Traditional multi-axis stepper motor controllers are based on microcontrollers (MCUs)/microprocessors (MPUs)/application-specific integrated circuits (ASICs)/digital signal processors (DSPs), supplemented by other peripheral discrete components. The advantage of this type of multi-axis stepper motor controller lies in its clear hardware structure and ease of replication; for similar applications, only the application software needs to be modified. However, for most practical applications, simple software modifications are usually insufficient to meet the requirements of other applications, and system upgrades typically require a complete circuit redesign, which prolongs the upgrade cycle and increases upgrade costs. Therefore, it has certain limitations in practical applications. Due to the rapid development of programmable logic device (PLD) technology, a single FPGA/CPLD chip can integrate the functions of multiple discrete components. Therefore, in improving traditional controllers, a single FPGA/CPLD chip is often used to integrate the digital circuitry of the traditional controller, forming a controller with a processor-FPGA/CPLD-analog circuit structure. Compared to traditional controllers, this type of controller offers significantly improved hardware scalability. This is because FPGA/CPLD chips have the characteristic of reconfiguring their internal logic without changing their pin definitions. Therefore, for different applications, the internal structure of the FPGA/CPLD chip can be modified to meet specific application requirements, making system development and upgrades simpler and less costly. Therefore, the application scope of this improved multi-stepper motor controller has been greatly expanded. However, this type of controller also has the following problem: a processor still exists outside the FPGA. This not only increases the size of the controller, but also requires redesigning the hardware circuitry when upgrading the processor, making the upgrade cost relatively high. In recent years, due to the widespread acceptance of the IP resource reuse concept and its adoption as the main design approach, embedded processor IPs such as MCUs, DSPs, and MPUs have become the core of FPGA applications. With the processor core embedded in the FPGA in the form of IP, future circuit boards may only have two parts: the analog part (including the power supply) and the FPGA chip and some large-capacity memory. All of this indicates that System-on-a-Chip (SOPC) is becoming the most important development direction for FPGAs. Compared with traditional multi-axis controllers, this SOPC-based multi-axis stepper motor controller has the characteristics of small size, high integration, stable hardware structure, easy development and upgrade, and low cost, making it particularly suitable for the design of internal control systems for instruments and meters. The multi-axis stepper motor controller discussed in this paper is a SOPC-based multi-axis stepper motor controller. 1. Hardware Structure of SOPC-Based Stepper Motor Multi-Axis Controller The block diagram of the SOPC-based stepper motor multi-axis controller is shown in Figure 2. Its external circuitry consists of two parts: analog circuitry and digital circuitry. The analog circuitry includes the power supply and power drive. The digital circuitry mainly consists of the FPGA chip and its related circuitry. As shown in Figure 2, the SOPC-based stepper motor multi-axis controller comprises two parts: the digital part of the FPGA chip and its configuration chip, and the motor control and position feedback part. The dashed box represents the internal structure of the FPGA chip, the hollow arrows represent the internal data connections of the FPGA chip, and the solid arrows represent the external connections. The FPGA chip internally consists of an MPU module, a communication module, a RAM module, a ROM module, a counter module, and a motor control module. When the controller loses power, the information from these modules is stored in the configuration chip. When the system is powered on again, the FPGA chip reads its configuration information from the configuration chip and reconstructs the internal module structure. The MPU module is the core of the entire controller, and its function is equivalent to a microprocessor. It exchanges data with the external host through the communication module and stores the data in the RAM module. The RAM module also temporarily stores intermediate values when the MPU module executes the program segments stored in the ROM module. The MPU then outputs corresponding control signals to the motor control module based on the program execution results in the ROM module. The output of the motor control module is connected to the actual chip pins to drive the corresponding power drive circuit, thereby enabling the stepper motor to operate. In closed-loop control, the encoder module at the stepper motor shaft outputs an encoded signal. This signal is isolated and processed by the encoder feedback circuit, then counted by the counter module inside the FPGA chip, and the result is transmitted to the MPU module for processing, thus forming a position/speed closed-loop control. Figure 2 only shows the structural block diagram of a single stepper motor closed-loop control. For multi-axis stepper motors, the FPGA chip only needs to add the corresponding power drive circuit and encoder feedback circuit. The motor control module and the counter module are both integrated inside the FPGA, so the hardware circuit structure is relatively stable. Due to the rapid development of IP technology, the IP cores of the MPU, ROM, RAM, and counter module in the FPGA chip modules shown in Figure 2 can be easily obtained. However, the motor control module is actually related to the specific power amplifier circuit, so it usually needs to be designed by the user. The design of this module is described below. 2. Two-Phase Stepper Motor Control Module Structure Taking a small-inertia two-phase stepper motor as an example, the structure of the stepper motor control module is illustrated. This stepper motor is driven by two PBL3717a chips. Its driving timing and control module are shown in Figures 3 and 4. In the control module, mtr_cp is the pulse input terminal of the stepper motor. Each pulse drives the stepper motor to move forward and backward one step. The pulse frequency is the speed of the stepper motor. Therefore, this pulse signal is output by the MPU module based on the execution result of the program inside the ROM. mtr_dir is the forward/reverse switching signal of the stepper motor, mtr_mode is the selection of the full/half-step operation mode of the stepper motor, and mtr_on_off is the start/stop bit of the motor. When this bit is 1, mtr_cp can drive the stepper motor to work; when it is 0, the mtr_cp pulse is blocked. The purpose of setting this bit is to control the start and stop of each motor separately when multiple stepper motors are working without affecting the operating status of other motors. `mtr_reset` is the control module reset signal, `A_out` is the control signal of the driver chip with subscript A in Figure 3, and `B_out` is the control signal of the driver chip with subscript B in Figure 3. Based on the above analysis, by appropriately connecting the multiple stepper motor control modules as shown in Figure 5, the SOPC-based multi-axis stepper motor controller discussed in this paper can be constructed. Since the MPU, ROM, RAM, and motor control modules are all integrated into the FPGA chip as functional modules, the size of the SOPC-based multi-axis stepper motor controller is greatly reduced. These functional modules can be added or removed according to actual applications (i.e., the internal logic structure of the FPGA chip can be reconstructed), thus greatly enhancing the flexibility of system design and better meeting the needs of different application areas. The rapid development of IP technology makes it easy for developers to obtain reusable IP cores for most general-purpose modules, thereby reducing the burden on developers and shortening the development cycle. When the system needs to be upgraded, there is no need to redesign the hardware circuit; only the configuration file of the corresponding module in the FPGA needs to be modified, thus saving the upgrade cost of the controller. Meanwhile, since the MPU module functions identically to a microprocessor, control programs that run on a microprocessor can be easily ported to the MPU module. To facilitate the explanation of the SOPC-based multi-axis stepper motor controller, this paper focuses on the scenario of multiple stepper motors operating at a constant speed. For variable-speed operation, this can be achieved by inserting a frequency divider module controllable by the MPU between the pulse output terminal of the MPU and the pulse input terminals of each motor control module. An interpolation module is also added to enable联动 (interlocking) between different motors. The SOPC-based multi-axis stepper motor controller described in this paper is applied to the sampling needle shifting system of a semi-automatic biochemical analyzer. It can achieve all the control functions of a traditional multi-axis stepper motor controller, while being smaller in size. When the digital circuitry of the controller needs modification, there is no need to replace the actual hardware circuitry, greatly facilitating the research and design of the controller and saving corresponding development costs.