Research on High-speed Processing of Serial Data by ARM Numerical Control System

I. INTRODUCTION Modern CNC machining uses CAD/CAM software to draw sketches of parts first, and then makes proper attribute settings according to sketches to generate G codes. After G codes are generated, G codes are transmitted to the CNC system in a certain way. Explain the transformation into actual axis motion. However, since the actual amount of G code data generated is relatively large relative to the ARM embedded CNC system storage resources, it is impossible to transfer all G codes to the ARM numerical control system for storage and then to explain and process them one by one. Therefore, the data transmission There should be a flow control problem in the process. Although there are many code transfer methods from PC G code to ARM control system, ARM's serial port is relatively easy to operate, so this design uses a serial port to transfer data. Although the serial port is convenient to operate, there are also some problems in the data transfer process. For example, if the PC transmits 9 data to the ARM, only 8 are received. If the data is transmitted, the data will be lost more, and If the data volume is large, the baud rate that needs to be transmitted is large, but a large baud rate will not only cause the data to be omitted, but also cause the G code transmitted to be not processed by the numerical control system in time. If the baud rate is too low, The delivery time will certainly be very long, reducing the processing efficiency.
What are the reasons for such a large number of problems? After analysis, a method is proposed to ensure that the data is correct and the data transmission speed and the code processing capability of the CNC system are improved. The 32-bit ARM controller based on the LPC series has the advantages of high speed, large capacity, stable performance, and easy on-line debugging. ARM has a broad prospect as an intelligent controller used in industrial control. In the application of ARM in the field of industrial control, data transmission and processing with the host computer software are often problems that need to be solved.
Second, the ARM serial port initialization settings and interrupt service program LPC2292 processor has two serial ports, each serial port has a 16-byte receive FIFO and 16-byte transmit FIFO, register location in line with the I6C550 industry standard, the receiver FIFO trigger point can be set to 1 , 4, 8, 14 byte trigger, built-in baud rate generator. There are four types of interrupts: data available interrupt, character receive timeout interrupt, THRE interrupt, and Rx line status interrupt. When the serial port is accepting data, a buffer queue is designed to store the received data.
(1) Data Cache Queue Data Structure Design QUEUE_DATA_TYPE represents the data type of the transmission. When data is sent from the serial port to the ARM, the data is queued through the In pointer. When there is data to be processed, the Out pointer is used to queue the data. As for the size of the queue, it depends on the baud rate, serial port interrupt frequency and other factors. Also need to implement two functions uint8 QueueWrite (void *Buf, QUEUE_DATA_TYPE Data), and uint8QueueReadQUEUE_DATA_TYPE *Ret, void *Buf), is mainly used to write data to the data queue and data from the data queue, using the first-in first-out (FIFO) mode.
(2) Serial Port Initialization Procedure:
U0IER = 0x05; /* Allow to receive and send interrupts */
}
(3) interrupt service routine interrupt handling function concrete realization 1. Data can be interrupt processing For (i = 0; i <8; i + +) / / Because the serial port initialization is 8-byte interrupt {QueueWrite (Buf, UARBR);}
2. Data timeout interrupt processing:
While(1)
{
If (UALSR&0x00000001= =1)
{QueueWrite (Buf, UARBR);}
Else Break;
}
3. Theoretically, THRE interrupts can be masked, but interrupts can also be handled. The processing method is to fill the data in the FIFO For (i=0;i<16;i++)
{
QUEUE_DATA_TYPE data;
QueueRead(&data, Buf)
U0THR = data;
}
4. The same line interrupt can also be shielded, of course, can also be handled, the processing method only needs to read U0TSR register Data = U0TSR;
The interrupt service routine handles the timeout interrupt, so setting the serial interrupt trigger byte can be set larger, which can ensure that the data will not be lost, reduce the number of system interrupts, reduce the system load, and increase the processing speed of the processor.
Third, the host computer software and ARM serial port data transfer software design ARM system opened up a serial data receiving queue buffer area, so it requires the host computer serial port sending software can cooperate with the ARM processing power to control the flow of data transmission.
In the program, NUM indicates the total number of characters in the file, which is transmitted to the ARM as a signal to start sending the file when the code data is started to be transferred, and serves as a basis for determining the end of the file transfer. SUM indicates the number of characters the code has transmitted. Its initialization value is 0.
Fourth, the conclusion:
The serial port settings are: baud rate 115200, 8 data bits, 1 stop bit, no parity, no flow control. Through the serial port debugging assistant, select the send file and send the processing file (size 182K) generated by the CAMXA manufacturing engineer of the CAM software on the PC. Through the serial port sent to the ARM numerical control system processing, the system can well ensure that the ARM CNC system correctly handles the G code, high-speed transmission of G code data.
The test shows that: a large number of G codes of the CNC system can be well processed, and has been applied to the design of the numerical control system. Practical inspection of the method can improve the machining efficiency of the CNC system.

Posted on