Research on CNC Milling Machine Based on Embedded Motion Controller

1 Introduction

CNC machine tools can realize the automation of processing, improve the production efficiency than the traditional machine tools, and the precision of the processing parts is high, and the size dispersion is small. China has a vast market for CNC transformation of machine tools. This article will use a general-purpose embedded motion controller for the numerical control transformation test of a vertical milling machine X8126. The original spindle system and cooling system were preserved during the transformation, and the X-axis, Y-axis, and Z-axis NC transformations were performed on the milling machine using a stepper motor drive system. The stepping distance after this transformation is 0.001mm/pulse.

2 Basic Principles of Numerical Control

2.1 Working Process of Numerical Control System

(1) Input the part machining program, control parameters, and compensation data to the CNC system.

(2) Processing program decoding and data processing.

(3) Interpolation. The motion trajectory is the result of multi-axis coordinated motion. In order to achieve the desired trajectory, it is necessary to control the motion of the relevant axis. The direct method is to determine the movement of each step of each axis in advance and store it in the memory of the computer. When the track is reproduced, each axis is controlled according to the stored data. However, this means storing large amounts of data, which is not practical in practical applications. In fact, the contour or trajectory is generally composed of straight lines and arcs, and for some non-circular curves, the line is approximated by a straight line or an arc. According to some small amount of basic data (starting point and end point can be uniquely determined a straight line, the arc only needs to give a given starting point, end point, radius and direction can be determined), through the calculation, the contour or trajectory of the workpiece is described, The calculation edge sends a feed command to each coordinate based on the calculation result. This is the basic idea of ​​interpolating, that is, interpolation calculation is the data between the starting point and the end point of the numerical control system according to a given type of curve (such as a straight line, an arc, or a high-order curve), a starting point, an ending point, and a speed. Densification of points. Of course, there is no interpolation problem for uniaxial motion.

The interpolation function of the numerical control system is mainly realized by software, and there are mainly two types of interpolation algorithms. One is incremental pulse interpolation, which is characterized by one feed pulse at the end of each interpolation operation; the other is digital incremental interpolation, which is characterized by one interpolation operation performed in each interpolation cycle. Calculate a tiny straight line data segment based on the command feedrate. The MCX314A chip contains high-speed, high-precision linear and circular interpolation functions.

(4) Servo control. The position feed pulse or feed speed command sent by the computer is transformed and amplified into the rotation of the servo motor (step motor or AC and DC servo motor) to drive the table to move.

(5) Tool compensation. In contour machining, when using different size tools to process the same contour workpiece, or the same nominal tool wear due to wear and thus size changes, in order to ensure control accuracy and programming convenience, the CNC system should normally have tool compensation.

2.2 NC machining program

NC instruction code programming conforming to ISO-840 international standard is a more general method of numerical control programming. Commonly used instructions include a prepared function G code, auxiliary function M code, spindle speed S code, and tool T code. NC program is composed of these function codes and data. If N0666 G01X20 Y20 F 300 indicates linear interpolation, XY feeds to the target point (20, 20) at the same speed of 300 mm/min.

CAD/CAM software such as Pro/Engineer and Beihanger CAXA can generate corresponding machining traces based on CAD contours of parts and generate NC code programs.

3 hardware components

As shown in Figure 1, the motion controller based on ARM and MCX314A is the control core of the system. Figure 2 shows the interface between the interface board and the driver. The pulse/direction signal output from the MCX314A is connected to the corresponding pulse/direction terminal of the driver via the interface board (26AMLS31 becomes a differential signal). The axis limit switch signal and the origin signal and the emergency stop signal are optically isolated from the interface board and connected to the MCX314A's nLMTP, nLMTM, Xin0, and EMGN pins.

Embedded sports
Figure 1 CNC structure of the mill after transformation

Embedded sports
Fig. 2 Connection diagram of adapter plate and stepper driver

The PC is connected to the LPC2214 via a serial port as the programming man-machine interface of the NC machining program. In the NC machining, the LPC2214 feeds back the logic position and status of each axis of the MCX314A to the PC. However, after the PC downloads the NC machining program to the motion controller, it can be disengaged and the motion controller has independent running capability.

4 Software Design

Using the PC's good man-machine interface and data processing capabilities, the PC is used as a human-machine interface for numerical control programming to perform syntax checks on NC programs and to preprocess NC programs. After PC preprocessing, the NC program is downloaded to the motion controller, and the LPC2214 saves the NC machining program into the Flash. During NC machining, the LPC2214 reads the machining code from the Flash and decodes the NC machining program. After the decoding is completed, the API function is called to realize the CNC function.

The upper PC acts as the human-computer interaction interface of the CNC system, completes the numerical control code editing (or receives the machining program generated by the CAD/CAM software), grammar check, and code preprocessing functions, and can communicate with the motion controller and the processed numerical control The code parameters are uploaded to the controller and can receive the (logic) position feedback and drive status information of the controller to realize the monitoring of the entire system. The program of the upper PC is developed with Visual Basic.

After the software and hardware basic platform of the motion controller has been established, the key point of realizing the numerical control application lies in converting the numerical control code into the call of the API function. The core content is to decode the numerical control machining program.

Embedded sports
Figure 3 CNC machining program decoding process

(1) Decoding of CNC machining programs.

A data structure CNCcodeBuf is defined to store the decoded result of a NC code line. Divide G code and M code into GA-GF and MX-MY groups to save storage space and improve decoding efficiency. Decoding process shown in Figure 3.

Struct CNCcodeBuf
{
Short N;//Number after storing NC code N
Int X,Y,Z;//value after storing X,Y,Z code
Int I, J, K; // The value after storing the I, J, and K codes
Int F;//stored value after F code
Int S;//value after storing S code
Short T;//value after storing T code
Unsigned char GA,GB,GC,GD,GE,GF;//storage sequence number of the G code after grouping
Unsigned char MX, MY, MZ;//Number of M code after grouping
}CNCBuf;

After the decoding of one line of code is completed, the code data is stored in the variable CNCBuf, and then what needs to be done is to transform it into a call to an API function. The method is to read the G, M code function number from the member of the variable CNCBuf, and complete the entry parameter setting of the API call one by one according to the API function corresponding to the function number.

(2) Communication. The host PC downloads the preprocessed NC code program to the motion controller in RS232 mode by adding the frame header "0xAA55AA" and the frame tail "0x55AA55". The communication format is set to: "38400, E, 8, 1".

5 Test Examples

In order to test the running effect of NC code, a “TEST” character string processing contour (CAXA software automatic tool compensation) is designed with BeiXing's CAXA software to generate a CNC G code PC. After the G code is preprocessed, it is downloaded to the motion controller for operation. . The recording trajectory of the recording pen complies with the design's intended outline.

N10G90G54G00Z60.000
N12S1000M03
N14X-24.992Y-8.481Z60.000
N16Z50.000
N18Z10.000
N20G01Z0.000F100
N22X-24.588Y-8.455F800
N24X-24.342Y-8.402
N26X-24.188Y-8.335
N28X-24.092Y-8.264
......
N890G02X21.410Y-8.481I0.927J-0.376
N892G01Z50.000F800
N894G00Z60.000
N896M05
N898M30

The author of this article innovates:

In this paper, the designed motion controller is applied in the transformation of economical CNC milling machine, and the application method is studied. The key is to convert the NC code into the API function encapsulated in the MCX314A command and make full use of the MCX314A's own interpolation function. .

references:
[1] Cai Hejun. Development of robotics and its application in manufacturing industry [J]. Machinery Manufacturing and Automation, 2004,33 (1): 6-7
[2] Ye Peiqing, Wang Jinsong. MCX314 motion control chip and numerical control system design [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2002
[3] Huang Letian, Xie Yi. Practical high precision intelligent constant temperature heater system design [J]. Microcomputer Information, 2005,10: 70-71
[4] Zhou Ligong. ARM Embedded System Series Tutorial [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2005
[5] Wu Hong, Jiang Shilong, Gong Xiaoyun, et al. Current status and development of motion controllers [J]. Manufacturing Technology and Machine Tools, 2004, (1): 24~27
[6] You Linru, Pang Yongpeng, Tan Ziyu. Development of Four-axis Motion Control Card Based on PCI Bus[J]. Microcomputer Information, 2007,3-1: 12-14

About the Author:
Tong Ruiyang: (1965-), male, Han nationality, Henan Pingdingshan native, undergraduate, associate professor, research direction: computer application technology Shao Guojin (1959-), male, Han nationality, Xiangcheng, Henan, associate professor, research direction for computer application technology

Biography:
TONG Ruiyang (1965-), Male, Han Nationality, Born in Henan Pingdingshan, Bachelor Degree, Associate Professor, Research areas: Computer Application Technology.
SHAO Guojin(1959-),Male,Han Nationality,Born in Henan Xiangcheng,Associate Professor,Research areas: Computer Application Technology.

Sport support

Sellers Union Group , https://www.sellersuniongroups.com