Research on high-speed serial port data processing in ARM numerical control system

Publisher:绿意盎然Latest update time:2016-09-13 Source: e-works Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
I. Introduction

  Modern CNC machining first uses  CAD / CAM  software to draw the machining sketch of the parts, then makes appropriate attribute settings according to the sketch, generates G code, and then transmits the G code to the CNC system in some way to interpret and convert it into actual axis movement. However, since the amount of G code data actually generated is large compared to the storage resources of the ARM embedded CNC system, it is impossible to transmit all the G codes to the ARM CNC system for storage and then interpret and process them one by one. Therefore, there should be a flow control problem in the process of data transmission. Although there are many ways to transmit PC G code to ARM CNC system code, the serial port of ARM is relatively easy to operate, so this design uses the serial port to transmit data. Although the serial port is convenient to operate, there are some problems in the data transmission process. For example, the PC transmits 9 data to the ARM, but only receives 8. If the data to be transmitted is large, more data will be lost. If the amount of data is large, a high baud rate is required for transmission. However, a high baud rate will not only cause data omissions, but also make the transmitted G code unable to be processed in time by the CNC system. If the baud rate is too low, the transmission time will definitely be very long, reducing the processing efficiency.

  What is the reason for so many problems? After analysis, a method is proposed to improve the data transmission speed and the code processing ability of the CNC system while ensuring the correctness of the data. The 32-bit ARM controller, mainly the LPC series, has the advantages of fast speed, large capacity, stable performance, and convenient online debugging. ARM has broad prospects in the field of industrial control as an intelligent controller. In the application of ARM in the field of industrial control, data transmission and processing with the host computer software is a problem that often needs to be solved.

2. ARM serial port initialization settings and interrupt service routine

  The LPC2292 processor has two serial ports, each with a 16-byte receive FIFO and a 16-byte transmit FIFO. The register position complies with the I6C550 industrial standard. The receiver FIFO trigger point can be set to 1, 4, 8, or 14 bytes. It has a built-in baud rate generator. There are four interrupts: data available interrupt, character reception timeout interrupt, THRE interrupt, and Rx line status interrupt. When the serial port receives 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. Whenever data is transmitted from the serial port to ARM, the data is queued through the In pointer. When data needs to be processed, the Out pointer is used to dequeue the data. As for the queue size, it depends on factors such as the baud rate and the serial port interrupt frequency. It is also necessary to implement two functions uint8 QueueWrite(void *Buf, QUEUE_DATA_TYPE Data) and uint8QueueReadQUEUE_DATA_TYPE *Ret, void *Buf), which are mainly used to write data to and retrieve data from the data queue, using the first-in-first-out (FIFO) method.

  (2)Serial port initialization procedure:

  U0IER = 0x05; /* Enable receive and transmit interrupts*/

  }

  (3) Interrupt Service Routine

  Specific implementation of interrupt handling function

  1. Data available interrupt processing

  For(i=0;i<8;i++) //Because the serial port is initialized with 8-byte interrupt

  {QueueWrite (Buf, UARBR); }

  2. Data timeout interrupt processing:

  While(1)

  {

  If (UALSR&0x00000001= =1)

  {QueueWrite (Buf, UARBR);}

  Else Break;

  }
 

  3. Theoretically, the THRE interrupt can be shielded, but the interrupt can also be processed by filling data into the FIFO.

  For(i=0;i<16;i++)

  {

  QUEUE_DATA_TYPE data;

  QueueRead(&data, Buf)

  U0THR = data;

  }

  4. Similarly, line interrupts can be masked and processed. The processing method only requires reading the U0TSR register Data = U0TSR;

  The timeout interrupt is handled in the interrupt service program, so the serial port interrupt trigger byte can be set larger to ensure that data will not be lost, while reducing the number of system interrupts, reducing system load, and improving processor processing speed.

3. Design of host computer software and ARM serial port data transmission software

  A serial port data receiving queue buffer is opened in the ARM system, so the host computer serial port sending software is required to be able to cooperate with the ARM processing capability to control the flow of data transmission.

  In the program, NUM indicates the total number of characters in the file. It is sent to ARM as a signal to start sending the file when the code data is transmitted, and is also used as the basis for judging the end of the file transmission. SUM indicates the number of characters that have been transmitted in the code. Its initial value is 0.

IV. Conclusion

  The serial port settings are: baud rate 115200, 8 data bits, 1 stop bit, no parity check, no flow control. Through the serial port debugging assistant, select send file and send the processing file (size 182K) generated by the CAM  software CAXA manufacturing engineer on the PC. Send it to the ARM CNC system for processing through the serial port. The system can well ensure that the ARM CNC system correctly processes the G code and transmit the G code data at high speed.

  Tests show that a large number of G codes of CNC systems can complete processing very well and have been applied to the design of CNC systems. Practice has shown that this method can improve the processing efficiency of CNC systems.

Reference address:Research on high-speed serial port data processing in ARM numerical control system

Previous article:Detailed introduction and technical knowledge of STM32 microcontroller
Next article:STM32 CAN bus basics

Recommended ReadingLatest update time:2024-11-16 01:36

Teach you the TFT-LCD driving method of ARM chip S3C2410
introduction S3C2410 is a RISC microprocessor based on the ARM920T core produced by Samsung. The main frequency can reach 203MHz. It is suitable for information appliances, Smart Phones, Tablets, handheld devices, mobile terminals and other fields. Among them, the integrated LCD controller is versatile and can interfa
[Microcontroller]
Teach you the TFT-LCD driving method of ARM chip S3C2410
ARM rookie's growth story - Part 1
It has been nearly half a year since I started working on ARM. I have made some progress on my first project. I finally feel like I have gotten started. In the past six months, I have experienced the freshness at the beginning, the depression in the middle, and the joy at the end. The process was tortuous and bizarre.
[Microcontroller]
Fingerprint recognition solution based on embedded ARM microprocessor
  Application Background   In the information age, biometrics technology has attracted more and more attention as an information security and personal identity recognition technology. Fingerprints are the most obvious external features of the human body, with the advantages of uniqueness, lifelong invariance, easy acq
[Microcontroller]
Fingerprint recognition solution based on embedded ARM microprocessor
Surprise! Arm China Executive Chairman and CEO Wu Xiong'ang was dismissed
        On June 10, according to the 21st Century Business Herald, Arm China Executive Chairman and CEO Wu Xiong'ang was dismissed.   "The past week has been in a tense state, and it involves legal procedures such as the replacement of the legal person. It has not been announced to the public yet." It is reported tha
[Embedded]
Surprise! Arm China Executive Chairman and CEO Wu Xiong'ang was dismissed
ARM7 MCU (Learning) - (II), Interrupt Control Programming - 02
After setting up the MDK interrupt~~ You can use it immediately after interruption~~ If you want to know more, look for the EDA software section~~ Just finish writing it today~~ 2. Interrupt Control Programming 2. (01) Counter (control the count addition, subtraction or clearing through three external interrupts)
[Microcontroller]
ARM7 MCU (Learning) - (II), Interrupt Control Programming - 02
Processor Architecture (IX) ARM and other architecture reference manuals including content abstract
The ARM architecture is divided into multiple versions, and there are version compatibility issues. Includes what-do-we-mean-by-architecture ARM core architecture // XXX core architecture. For example, VFP Programming Model type of data Processor Mode register abnormal Big and small endian Unaligned ac
[Microcontroller]
22 concepts about ARM
1. Explanation of some common English abbreviations in ARM MSB: most significant bit; LSB: least significant bit; AHB: Advanced High-Performance Bus; VPB: VLSI peripheral bus that connects on-chip and off-chip functions; EMC: External Memory Controller; MAM: Memory Acceleration Module; VIC: Vectored Interrupt Controll
[Microcontroller]
Learn ARM development(18)
Last time, we have learned about the interrupt handling process of ARM and how to set the interrupt function. So, does it work like this? The answer is no. Because S3C44B0 has several registers that control whether the interrupt is turned on. These registers are as follows: 1. Program Status Register (CPSR).
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号