Design and Implementation of PC-based CNC Software


Abstract This paper provides a general structure of PC-based CNC software in Windows environment, and explores several implementation methods.

Keywords CNC, multitasking, real-time processing

1 Overall structure and implementation method

1.1 The overall structure of the software

The CNC system is often used as an independent process control unit for industrial automation production processes, so its system software must perform both management and control functions. The CNC system is composed of software and hardware, and the hardware provides a support environment for the operation of the software. Since the hardware and software are logically equivalent, the work done by the hardware can also be done by software in principle. Therefore, the structure of the software depends on the division of software and hardware, and on the nature of the software itself. According to the current design of the system, the lower position machine is only responsible for position servo control, so the upper machine is responsible for the rest of the management work and control work.

The overall structure of the CNC software can be designed into six layers, namely the input layer, the decoding layer, the tool compensation layer, the coordination layer, the monitoring layer, and the device driver layer. The input layer is a numerical control program. The decoding layer interprets the NC instructions into the internal data format of the CNC system. The tool compensation layer performs tool compensation. The coordination layer decomposes the instructions into the various functional components of the control system. Such as CNC command translation, auxiliary function device control and motion control. The monitoring layer checks the current state of the system and the legality of the current instructions. The device driver layer directly controls the system functions.

In the software of the numerical control system, the front-back type structure is adopted, and the foreground program is a real-time interrupt program to complete all real-time functions (including the coordination layer, the monitoring layer, and the device driver layer), mainly the interpolation function and the system diagnosis function. , I / O processing, and so on. The main functions of the background program are the pre-interpolation preparation function and scheduling management (including the input layer, the decoding layer, and the tool compensation layer). Specifically, it is between the NC program input, decoding, tool compensation, display, and the above tasks. Scheduling management function. The background program is a loop running program. During the running process, the foreground program (interrupt service program) is continuously inserted to complete the part processing tasks. The task of position servo is mainly done by the lower computer.

In the decoding layer and the tool compensation layer, we use multi-task scheduling to coordinate the work of the system, and optimize to make full use of the system resources. After the machining program is decoded by the host computer, tool compensation, and speed processing, the interpolation command data of the tool center is obtained, and the host computer stores the interpolation instruction data and other instruction data in a buffer in a fixed format, each time. When the interrupt occurs, the host computer performs corresponding processing according to the command data. If there is an interpolation command, the interpolation data is calculated in real time and sent to the lower computer, and the lower computer controls the motor action of the corresponding axis from the buffer according to the data. When one frame of command data in the host computer is read, the new interpolation command data is automatically calculated in the interpolation gap and filled in the buffer.



CNC software overall structure

A plurality of interpolation buffers are set in the memory of the upper computer, and the position of the current data block is indicated by the flag word, and the lower computer is guided to read the current instruction data. When the lower computer performs control, the upper computer continuously performs pre-interpolation calculation until all the interpolation buffers are filled. When receiving the interrupt signal of the lower computer, the upper computer performs real-time interpolation calculation and sends the data to the data. Lower position machine. In this way, the time of the CPU of the host computer can be utilized to the fullest, and real-time parallel real-time work can be realized.

1.2 Software implementation method

1.2.1 Software operating environment and development environment

Using Microsoft Windows 3.1 as the development environment, Borland C++ 3.1 is used as the programming language.

1.2.2 Specific implementation methods

. Startup screen modification

When Windows starts up, a splash screen with the Microsoft logo appears, but as a dedicated CNC system, we hope to replace the splash screen with its own splash screen to display the splash screen with the CNC system logo. Methods as below:

Next page

LOCK ASSEMBLY MACHINE

Lock Assembly Machine,Lock Cylinder Assembly Machine,Cnc Key Cutting Machine,Lock Key Cutting Machine

NANTONG DONOR COMPANY LTD , https://www.ntdonglan.com