Share this

Development of an Economical Five-Axis Machine Tool CNC System Based on PCI04 Parallel Port Drive

2026-04-06 04:29:47 · · #1
To construct a streamlined, low-cost, and economical five-axis CNC system for machine tools, this paper adopts the real-time embedded multi-tasking operating system RTLinux as the software platform and the industrial embedded computer PC-104 as the hardware platform. A parallel port is used as the stepper motor drive control interface, and stepper motor position control is achieved through software programming. Experimental results demonstrate that this CNC system can effectively achieve five-axis machine tool linkage control. Economical CNC systems characterized by stepper motor drives are inexpensive, have moderate precision, and are highly targeted in their functions. For the predominantly low- and mid-range machine tools in China, economical CNC systems still have considerable market potential. In the development of economical CNC systems, the goal has always been to improve system performance while minimizing hardware design, reducing costs, and improving reliability. To achieve this goal, this paper studies the development and design of a five-axis CNC system based on a parallel port driver, using the real-time embedded multi-tasking operating system RTLinux as the software platform and the general-purpose industrial embedded computer PC-104 module as the hardware platform. 1 System Hardware Composition The CNC system adopts a hardware structure based on PC-104. The hardware structure block diagram is shown in Figure 1. To meet the system performance requirements, a low-power Pentium-III processor is used as the main CPU unit, with a hardware interrupt latency of less than 25μs. The conventional position control module in the system is implemented by the main CPU in software, reducing hardware costs and improving reliability. System programs, application programs, and machining code are stored using DOC or CF cards. The system uses parallel port output to interface with external devices. Figure 2 shows the standard parallel port structure. The standard parallel port has 12 output bits (D0-D7, C0-C3) and 5 input bits (S3-S7). Since each stepper motor driver requires 2 digital bits (pulse and direction) for control, the five-axis system occupies a total of 10 digital output bits. The pulse and direction signals output from the parallel port are amplified by the stepper motor driver to drive the stepper motor. The other two digital output bits are used to control the coolant switch and lubricant switch, respectively. The spindle switch and speed are controlled by buttons on the spindle inverter. The parallel port input bits are used to detect the homing switch signal, limit switch signal, and emergency stop input signal. Due to limited input bit resources, the positive limit, negative limit, and homing signals of the five-axis motors are connected in parallel, with each parallel bit occupying one parallel port input bit, for a total of three bits. The emergency stop switch input signal occupies one parallel port input bit. The specific signal pin arrangement is shown in Table 1. 2 System Software Structure The ideal software platform for a CNC system should be an operating system with both multi-task scheduling capabilities and excellent real-time performance, i.e., a real-time multi-task operating system. This paper uses Rtlinux as the software platform for the CNC system. Rtlinux is an operating system developed by FSM Labs in New Mexico, USA, for real-time and embedded applications. Rtlinux is a small real-time kernel implemented on top of Linux. It runs the Linux kernel as a task with the lowest priority, which can be preempted by other high-priority tasks. Because it completely preempts the Linux kernel task, its response speed is particularly fast. On a 386 machine, the interrupt response time of Rtlinux will not exceed 25μs, thus meeting the requirements of the CNC system. [IMG=Figure 1 Hardware Structure Block Diagram of CNC System Based on PC-104]/uploadpic/THESIS/2007/11/2007111410262995567U.jpg[/IMG] Figure 1 Hardware Structure Block Diagram of CNC System Based on PC-104 [IMG=Figure 2 Standard Parallel Port Structure Diagram]/uploadpic/THESIS/2007/11/2007111410283895871F.jpg[/IMG] Figure 2 Standard Parallel Port Structure Diagram [IMG=Figure 3 CNC System Software Structure]/uploadpic/THESIS/2007/11/2007111410324711596S.jpg[/IMG] Figure 3 CNC System Software Structure In a CNC system, management tasks and control tasks must be processed simultaneously and in parallel, which is determined by the working characteristics of the CNC device. This means that the control strategy calculation must be completed within one interpolation cycle, while also allowing time for other tasks, such as user interface interaction. In single-microprocessor CNC devices, resource time-sharing is mainly used to solve the parallel operation of multiple tasks. Simultaneously, Rtlinux and Linux are combined to jointly process tasks in the CNC system according to real-time requirements. Figure 3 shows the software structure of the CNC system, which consists of four main parts: Graphical User Interface (GUI), Task Assigner (TASK), Motion Controller (MOT), and Input/Output Controller (IO). This figure illustrates how the system achieves real-time control of the equipment. The machine code is interpreted into standardized commands, which are then sent by the Task Assigner (TASK) to the Motion Controller (MOT) and Input/Output Controller (IO) for execution. The GUI is programmed using TCL/Tk language and runs in the Linux user space, with an interface update time of 0.2 seconds. It is used to set manual, automatic, and MDI working modes, input and edit machining code files, set system and user parameters, display the machining process position and graphics, and provide system alarm and diagnostic information. TASK accepts C and M series mechanical codes from the graphical user interface or other external programs, interprets them into standardized commands, and issues commands to the motion controller and input/output controller in sequential logic. The task assigner works in the Linux user space and is woken up every 10ms. The task assigner communicates with the GUI, MOT, and IO through shared memory. The motion controller is the most important component of the CNC software. It undertakes four main real-time tasks: (1) Position sampling. The current position of the stepper motor is accumulated using a counter. (2) Coarse interpolation. The next point on the motion trajectory is calculated. (3) Fine interpolation. Interpolation is performed between the current point and the next trajectory point. (4) Calculate the control output of the motor. For stepper motors, the direction, frequency, and number of pulses that each stepper motor needs to output within the sampling period are calculated using a control algorithm. The real-time performance of the motion controller requires it to work in the Rtlinux kernel space, and the real-time kernel ensures that the real-time tasks are updated every 0.5ms. The input/output controller is mainly responsible for the operation and control of spindle control, coolant switch, lubricant switch control, and other auxiliary functions. It operates in Linux user space and updates its tasks every 100ms. 3. Software Implementation of the Position Control Algorithm To fully utilize the advantages of fast response and high control accuracy of PID-based closed-loop feedback control in motor speed control systems, this paper adopts an approximate closed-loop control method for the stepper motor. Its control structure is shown in Figure 4. [IMG=Table 1 Parallel Port Signal Pin Arrangement]/uploadpic/THESIS/2007/11/2007111410372693176C.jpg[/IMG] Table 1 Parallel Port Signal Pin Arrangement [IMG=Figure 4 Stepper Motor Closed-Loop Control Structure Diagram]/uploadpic/THESIS/2007/11/2007111410391940376A.jpg[/IMG] Figure 4 Stepper Motor Closed-Loop Control Structure Diagram [IMG=Figure 5 Soft Frequency Divider Working Process Diagram]/uploadpic/THESIS/2007/11/2007111410413495314D.jpg[/IMG] Figure 5 Soft Frequency Divider Working Process Diagram [IMG=Figure 6] [Actual machining process and machined workpiece]/uploadpic/THESIS/2007/11/2007111410440880549F.jpg[/IMG] Figure 6 Actual machining process and machined workpiece In the figure: Ri is the position of the machine tool motion command in the current sampling period; Yi and Yi-1 are the expected output positions of the machine tool motion in the current sampling period and the previous sampling period, respectively; D(z) is the PID controller; OutputScale is the output conversion ratio, which is the electronic gear ratio divided by the lead screw pitch, and the product of the motor speed ui and the output conversion ratio is the motor calculated rotation frequency fi; InputScale is the input conversion ratio, which is the same as OutputScale; 1/(1-z-1) is the digital integral element, Si is the expected number of output pulses of the motor in the current sampling period; z-1 is the delay element of 1 sampling period; SFD is the software frequency divider, which converts the motor calculated rotation frequency fi into pulse and direction signals to control the actual movement of the motor, and Y is the actual rotation angle output of the motor. Define the position error ei=Ri-Yi-1, then the expression of D(z) is: Where: P, I, and D are the proportional, integral, and derivative control coefficients, respectively. In Figure 4, for the input Ri and the output Si, the system is a typical controlled object, which is an integral element with a periodic delay. By adjusting the appropriate P, I, and D coefficients, the system can have good steady-state and dynamic performance. After obtaining the motor's calculated rotation frequency fi, the design steps of the software frequency divider are described in detail below: (1) Create a real-time thread in the kernel space of Rtlinux. The execution cycle of this thread is PULSE_PERID=50000ns. This thread acts as a soft crystal oscillator in the software frequency divider. pthread_create(&freqTask, &attr, freqfunc, (void *)1); pthread_setfp_np(freqTask, 1); pthread_make_periodic_np(freqTask, gethrtime() + PULSE_ERIOD, PULSE_PERIOD); (2) Calculate the frequency division coefficient pdmuh, and use the crystal oscillator frequency divided by the motor to calculate the rotation frequency. pdmuh = HRTICKS_PER_SEC / (abs(fi) * PULSE_PERIOD) where HRTICKS_PER_SEC is the number of ns per second. (3) In the real-time periodic function fnqTask, two down counters upcount and dwcount are defined, and the counting period is PULSE_PERID. That is, freqTask is executed once every PULSE_PERID time. At this time, the count value of the counter is decremented by 1. The initial values ​​of upcount and dwcount are pdmult/2 respectively. pulse_bitO represents the corresponding pulse control bit on the parallel port. Figure 5 shows the workflow of the soft frequency divider. It can be seen from the figure that the output pulse control bit changes level once every pdmuh/2*PULSE PERID time, thus ensuring that the output pulse frequency is . (4) In freqTask, the positive and negative values ​​of the judgment determine the level of the direction control bit direction_bit0 on the parallel port. When fi>0, direction_bit0=0; when fi<0, direction_bit0=1. The direction control bit is output when dwcount=0. 4 Experimental Results A practical machining experiment was carried out on a self-developed five-axis machine tool with a swivel turntable driven by a stepper motor. A workpiece with the letter τ engraved on a sphere was drawn using Suffcam software. τ is the actual tool path during machining. The radius of the sphere is 15mm. The actual machining C code obtained after post-processing was used for actual machining using the developed CNC system. Figure 6 shows the actual machining process and the machined workpiece. As can be seen from the machining results in Figure 6, the CNC system based on PCI04 parallel port drive described in this paper can effectively realize the linkage machining of an economical five-axis CNC machine tool. 5. Conclusion This paper introduces the software and hardware design of a CNC system capable of realizing linkage control of an economical five-axis machine tool, using the real-time embedded multi-tasking operating system RTLinux as the software platform and the industrial embedded computer PC104 as the hardware platform. Stepper motor position control is achieved through software programming of the PCI04's wellhead position. Actual workpiece machining demonstrates that the CNC system has the capability for five-axis machine tool linkage machining. This CNC system can maximize the utilization of system software resources and reduce hardware design. All functions in the CNC system are implemented through software programming, increasing the flexibility for system modification and expansion. (Proceedings of the 2nd Servo and Motion Control Forum, Proceedings of the 3rd Servo and Motion Control Forum)
Read next

CATDOLL Miho Hard Silicone Head

The head made from hard silicone does not have a usable oral cavity. You can choose the skin tone, eye color, and wig, ...

Articles 2026-02-22