Design and Implementation of PC-based CNC Software

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 in the industrial automation production process, so its system software must complete two major functions of management and control. The CNC system is composed of software and hardware. The hardware provides a support environment for software operation. Since 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, but also depends on the nature of the software itself. According to the current design of the system, the lower computer is only responsible for the position servo control, so the upper computer is responsible for the rest of the management work and control work.
The overall structure of numerical control software can be designed into six layers, namely input layer, decoding layer, tool compensation layer, coordination layer, monitoring layer, and device driver layer. The input layer is a numerical control program. The decoding layer interprets the numerical control instructions as the internal data format of the numerical control system. Tool compensation for tool compensation. The coordination layer decomposes the instructions into various functional components of the numerical 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 legitimacy of the current instruction. The device driver layer directly controls the functional components of the system.
In the software of the CNC system, a front-end and back-end structure is used. The foreground program, that is, the real-time interrupt program, completes all the real-time functions (including the coordination layer, the monitoring layer, and the device driver layer), mainly including the interpolation function and the system diagnosis function. , I/O processing, etc. The main function of the background program is the preparation function before the interpolation and the schedule management (including the input layer, the decoding layer, the tool compensation layer). Specifically, it is between the NC program input, decoding, tool compensation, display and the above tasks. Scheduling management functions. The background program is a circular running program. During the running process, the foreground program (interrupt service program) is continuously inserted to complete the parts processing task. The position servo task is mainly completed by the lower computer.
In the decoding layer and the tool offset layer, we use multi-task scheduling to coordinate the work of the system. After optimization, we can make full use of the system resources. After the machining program is decoded by the host computer, tool compensation, and speed processing, the tool center interpolation command data is obtained. The host computer stores these interpolation command data and other command data in a buffer in a fixed format, each time. When the interrupt occurs, the host computer performs corresponding processing according to the instruction data. If there is an interpolation instruction, the interpolation data is calculated in real time and sent to the lower machine. The lower machine controls the motor operation of the corresponding axis from the buffer according to these data. When a frame of instruction data in the host computer is read, new interpolation instruction data is automatically calculated in the interpolation gap, and the buffer is filled.

NC software overall structure diagram

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

1.2 The specific method of software implementation

1.2.1 Software Operating Environment and Development Environment

Using Microsoft Windows 3.1 as a development environment and Borland C++ 3.1 as a programming language.

1.2.2 Concrete Implementation Method

Startup Screen Modification When Windows starts, a splash screen with the Microsoft logo appears. However, as a dedicated CNC system, we hope to replace the startup screen with our own startup screen and display a startup screen with the logo of the CNC system. Methods as below:
method one:
(a) Create a BMP map and compress it into an RLE file named CNC.RLE;
(b) Execute the following command to form a new WIN.COM module:
COPY/B WIN.CNF +VGALOGO.LGO+CNC.RLE
(c) Restart Windows to see the new splash screen.
Method Two:
(a) Compile a program for displaying graphics under DOS. The graphics can be in any format (*.bmp, *.gif, *.jpg, etc.), and you can select the graphics you want and like to use as startup symbols.
(b) Prepare a batch file, put the graphical display program first, and put the Windows startup command Win/B behind (/B option makes the startup flag not appear);
(c) Replace the original Windows startup command with the generated batch file and run it.
Implementation of Multi-task Scheduling In our CNC system, in order to achieve coordination and management of multiple tasks, we use non-preemptive multi-task scheduling and multi-buffering to achieve tasks that are not real-time ( The specific implementation of the scheduling of NC program input, decoding, tool compensation, display, etc. is:
(a) Prescribe each task priority calculation method (priority is not fixed);
(b) Create a task queue to sort the current tasks that need to be completed. This queue does not consider the priority;
(c) In each task cycle, calculate the priority of each task and execute the task with the highest priority;
(d) Store the result of each task execution in multiple buffers and then execute the next task of the same type.
In the numerical control system, the displayed task priority is always the lowest, while the priority of other tasks is changed. By varying the priority of each task to coordinate, although the task with the highest priority is executed each time, each task is actually executed and displayed without other tasks.
Multi-buffer implementation method In order to coordinate the operation between multiple tasks, create multiple data buffers in the software, the specific implementation method is:
(a) Allocating memory for multiple buffers, creating read and write pointers to the current buffer, forming a circular multiple buffer;
(b) Setting a flag for each block of memory as a basis for determining the operation of each buffer;
(c) Every read of a buffer, a read flag is set for that buffer, and the current read pointer moves forward by one buffer;
(d) Each time a buffer is written, a written flag is set for the buffer, and the current write pointer moves one buffer forward;
(e) For the buffer whose current operation is not completed, set the operation flag to prohibit other operations.
Using this method, the operations that must be completed in a single interpolation cycle in the system are "homogenized" in multiple interpolation cycles, effectively using the CPU's calculation time, and improving the system's working efficiency.
Implementation of Windows Interrupts Windows is a non-exclusive multitasking system. The application receives input through the application queue. The message loop then takes the input message from the application queue and sends it to the corresponding window. . In this mode of operation, real-time control is difficult. However, from another perspective, the user's keyboard, mouse, and timer inputs are hardware interrupts, and the device drivers provided by Windows are actually interrupt service routines. Because the actual processing requires high real-time performance, it must be interrupted to achieve real-time tasks. Since interrupts can occur at any time, and are not limited to applications running with the device, the interrupt service routine must be in a fixed code segment. In a large-frame EMS memory configuration, only one type of code can guarantee that such an interrupt service can be used at any time. This type of code is a code in a fixed code segment of a dynamic link library (DLL). On the premise of ensuring reliability, DLL must be used to implement the interrupt. Using DLLs in our system implements hardware interrupts and is reliable.
Replace the system shell, become a special system Windows Progman.exe is the Windows shell, is an important part of Windows, but not an essential part of Windows, each user can prepare their own shell. Because the CNC system is directly connected to the production equipment, users often want the CNC system to be a dedicated system. In addition, Windows itself is a multi-tasking system. Executing multiple applications at the same time may cause conflicts between programs. Therefore, it is necessary for Windows to perform Transformation, transformation method is very simple, using NC software instead of Windows "Shell" - Progman.exe, so that Windows starts directly after the operation of CNC software, in the user's operation, do not feel the existence of Windows, while avoiding the application Conflict between software and hardware.

2 later words

The PC-based CNC is an inevitable trend in the development of NC technology. It ensures that the basic hardware and software of the CNC are continuously updated with the PC technology, so that the NC technology closely follows the development of the PC technology and can directly apply the development results of the PC. It is of great significance to save development costs and shorten the development cycle.

Heat Treated Steel Bar And Tube

HEAT TREATED STEEL BAR AND TUBE

Heat treated steel bar is produced by heating and cooling in different temperature based on the steel grades to improve the steel bar mechanical properties or machinability for various industrial applications. Heat treated steel bar includes annealed steel bars, Normalized Steel Bar, quenched and temper qt steel bar.

Annealed Steel Bar has better ductility and lower hardness, which can be easier to be machined. The annealing processing is usually widely used for steel grade with higher carbon content above 0.5%. However, some low carbon steel also requires to do annealing for special usage such as 20CrMnTi gear steel. For some special material such as 20CrMnTi gear steel and GCr15 such bearing steel, spheroidizing annealing is often required.

Normalized steel bar sometime is also one kind of annealing processing. It mainly changes the grain to remove the impurities in steel and improves the strength and hardness. For some hot rolled steel bars, to keep the basic mechanical properties, normalizing is often used.

Quenching and Tempering, abbreviated as Q&T is a king of processing that strengthen or harden steel bars by heating the materials and then cooling in water, oil or other liquid medium, that rapidly the change from austenite to perlite to get the proper properties for various usage. The quenched & tempered steel bar materials are usually with carbon from 0.30% - 0.60%, it is widely used as merchant bars in components of various machines.

Qt Bar

Our advantages on producing heat treated steel bars:

1) Big stocks of hot rolled round bars or wire rods as raw materials

2) Wide range of Cold Drawn Steel Bar sizes: from 10mm to 150mm

3) Different cold drawing medias powder or oil to get different surface

4) Straightening machines to get better straightness up to 0.5mm/m

5) Grinding and polishing machines to get better roughness upto 0.4um

6) Heat treating furnaces to adjust the mechanical properties

7) Full sets of testing equipment to test the sizes, mechanical properties and microstructure.

8) Multiple packages to avoid broken packages and anti-rusty

Astm A193,Round Steel Tubing,Heat Treated Steel Tube,Heat Treated Steel Bar And Tube

SHANDONG LE REN SPECIAL STEEL CO., LTD. , https://www.sdcolddrawnsteelbar.com