1 Introduction The XK7136 vertical machining center was originally equipped with a CNC servo system and DC servo motor from AB Company of the United States; the rotary tool magazine has a capacity of 16 tools and is automatically changed by a pneumatic device; the spindle is an analog servo spindle from INDRAMAT Company of Germany. The original control system of the machining center had three shortcomings: (1) due to the influence of the external environment, the analog signal was greatly interfered with, and because the machine tool was a semi-closed-loop control, the positioning accuracy was not high, so the machining accuracy of the machine tool was not high; (2) when changing tools, the number of rotation steps of the tool head was calculated by an absolute method, which made the tool finding take a long time; (3) the spindle was controlled by an external circuit and did not communicate with the system, making control inconvenient. After the SKY CNC system was modified, the high precision, high speed and easy control of the machine tool were achieved. 2 Modification of the servo system The SKY CNC system is a CNC system developed on the PC platform. It realizes signal conversion and input and output through the ISA multi-function card of the PC. In the machine tool retrofit, the SKY system's unique dual-position closed-loop control method was adopted, with the servo unit using a digital AC servo motor (Figure 1). The dual-position closed-loop system overcomes the nonlinear effects of typical full closed-loop systems (speed loop + position loop), preventing self-sustaining oscillations that would render the system inoperable. It consists of an outer position loop formed by a position detection element (grating ruler) and an ISA card position comparator, and an inner position loop formed by a photoelectric encoder driven by the servo motor and an ISA card position comparator, creating a rotational-linear displacement dual closed-loop system. Since the inner rotational loop forms a follow-up system, when the system displacement command is issued, the position detection element in the outer position loop directly acquires the table's displacement information and drives the table via the servo motor through the inner loop's following property. The system compares the grating's feedback value with the command value using the position comparison circuit of the ISA card, using the difference for control until the difference is eliminated. At this point, the grating's feedback value equals the command value, theoretically eliminating the impact of machine tool backlash on accuracy. The grating ruler has an accuracy of 5μm, resulting in very high machining accuracy for the machine tool. The advantage of using a digital AC servo motor is its strong anti-interference capability. After the command signal is issued in binary code form, it is transmitted as a set of pulse signals, making it less susceptible to interference from the external environment. Furthermore, the binary code is transmitted in the form of a detection code to ensure its correctness. Figure 1 Signal Processing Block 3 Tool Change Control Modification The automatic tool changer (ATC) of the machine tool uses pneumatics to realize the up, down, left, and right movement of the rotary tool magazine and the clamping/releasing of the tool. The rotation of the tool head is achieved through the Martens wheel transmission principle. 1) Hardware Circuit Design for Tool Finding In the tool change control, we made the following modifications to the ISA card (Figure 2). When the tool change command M06 TXX is issued, the system program determines the rotation direction of the tool head based on the current tool number and the target tool number of the command and calculates the number of rotation steps. Then, control signals X0 and X1 are sent to the PLC through low I/OU to control the forward and reverse rotation of the rotary motor (the control states of X0 and X1 are shown in Table 1). Each time the cutter head rotates past a cutter number, proximity switch S1 sends a signal to SCU. SCU counts once, and when the SCU count equals the required number of rotation steps, the cutter head rotates to the target cutter number. The system program controls I/OU to output a control signal (0, 0) to the PLC, stopping the cutter head rotation motor. Figure 2: S1. Sensor (proximity switch) on the rotating cutter head; SCU. Cutter head rotation step calculation circuit; I/OU. Communication interface between PC and external devices. 2) The algorithm of the tool finding program numbers the 16 tool holders of the rotating cutter head from 1 to 16. Assume: the current cutter number is stored in the power-off protection register R1; the target cutter number of the instruction is stored in register R2. Then the number of rotation steps n = |R2 - *R1| (n[0, 15>). However, if n > 8, the number of rotation steps is not the minimum number of steps, so the rotation direction of the cutter head must be changed, and the number of rotation steps is 16 - |R2 - R1| (Table 2). This algorithm can calculate the minimum number of rotation steps required for the tool turret and determine its rotation direction. When the system receives the M06 TXX command, the system program first compares R2 with ∠R1, n = R2 - *R1. If n = 0, M06 is complete; if n ≠ 0, the system begins to determine the rotation direction of the tool turret and calculate the number of rotation steps, while simultaneously returning the Z-axis to the tool change point. Then, the system sends signals to the PLC to sequentially control the spindle positioning, the up, down, left, and right movement of the tool turret, and the tightening/loosening of the tool, among other actions. 4. Modification of the Spindle Control Section Communicating the SKY CNC system with the INDRAMAT analog servo spindle control unit is an essential step in modifying the spindle control section. This communication is also achieved by connecting the ISA card and the PLC to the spindle control unit (Figure 3). When the system receives a spindle rotation command, it sends a binary code (in two's complement form for easy sign determination) to the ISA card's D/AC, based on the product of the command's rotational speed and the current spindle speed multiplier. This binary code is then converted into an analog signal and output to the SCU. The system sends a 32-bit binary code, which the D/AC converts into an analog signal of +10 to -10. The rotational speed is determined by the maximum rotational speed vsmax set in the SCU and the current analog voltage value U, calculated as: vs = U * vsmax / 10. When U is positive, the spindle rotates clockwise; when U is negative, the spindle rotates counterclockwise. When the system receives command M03 SXXXX, the command value is positive, U is positive, and the spindle rotates clockwise; if the command is M04 SXXXX, the command value is negative, U is negative, and the spindle rotates counterclockwise. Figure 3 shows the D/AC (Digital-to-Analog Converter) circuit, SOC (Spindle Speed Multiplier) circuit, and SCU (Spindle Control Unit). The PLC controls certain switching signals in the SCU, such as the spindle enable signal. When the system receives the M03 or M04 command, the I/O unit sends a signal to the PLC, which then sets the spindle enable signal high, causing the spindle to rotate. After being upgraded with the SKY CNC system, this machining center improved machining accuracy and tool change speed, made spindle control more convenient, and reduced spindle speed deviation.