Design of embedded plc in machine tool numerical control system

In the numerical control system of machine tools, the control of electrical equipment occupies an important position. At present, the programmable controller (PLC) is generally used for electrical control of the machine tool. The PLC has high reliability and is easy to use. For complex applications with a large number of control points, a certain number of expansion units can be added outside the basic unit of the PLC to realize complex electrical control functions. On CNC machine tools. If the PLC is used for electrical control, it is necessary to establish an electrical connection between the PLC and the NC. Otherwise, the MST command in the NC program cannot be reflected in the PLC, and the PLC cannot perform the corresponding action. PLCs currently on the market generally have communication functions that can be used to establish a connection between the PLC and the NC. Since the communication mode of PLC is serial communication, the communication speed is relatively low, and some signals with strong real-time requirements for numerical control machine tools such as emergency stop, overtravel, etc. It is difficult to win any other measures that must be taken to meet these special needs, but this adds to the complexity of the system. In order to increase speed, reduce the cost. In the numerical control system, the switch I/O board and the external relay can be used, and the software of the host computer is used to control the electric switch. However, this program week NC host should directly participate in the operation process of the electrical control logic. It takes up part of the working time of the host and increases the complexity of the software. more importantly. Concentrating too many functions on the host increases the risk of host-failure due to real-time and reliability considerations. The author is in the process of developing a five-axis linkage CNC system. An embedded PLC is designed. While ensuring real-time performance. The risk of failure is relatively dispersed.

1 Embedded PLC hardware structure

The five-axis linkage CNC system we developed is a multi-CPU distributed open CNC system based on industrial PC. As part of this, the design of embedded PLCs must also follow the principle of openness. Its hardware is modular. Designed according to standard industrial computer cards. At present, there are two types of backplane buses of industrial computers: ISA bus and PCI bus. The data transfer rate of the ISA bus is much lower than that of the PCI bus. However, it has been able to fully meet the needs of general industrial control, and the ISA bus has more requirements for industrial computer expansion cards than PCI. From the experience of existing industrial applications. Reliability is also relatively high. Therefore, we still choose ISA bus as the basis of embedded PLC design.

The composition of the embedded PLC is shown in Figure 1.

Design of embedded plc in machine tool numerical control system

The embedded PLC CPU uses the Intel 16-bit microcontroller 80C196. Its unique register-accumulator structure and three-operand instructions can greatly reduce the number of data transfer instructions in the program and improve the efficiency of program operation. The dual-port memory in Figure 1 is used to exchange information between the PLC and the CNC system host. During the operation, the PLC performs the electrical control logic operation at the same time. The contents of the dual-port RAM are also periodically refreshed, and the electrical switch state, PLC operating state, and the like are reflected in the dual-port RAM. There are some panel buttons such as cycle start, feed hold. Manually for NC operations, it cannot be processed as normal I/O points. The embedded PLC recognizes the key operations and maintains a loop team record in the dual port RAM to record these key operations. On the other hand, the NC software modifies the specific data in the dual-port RAM according to the M, S, and T fingers in the machining program, and the PLC periodically reads the data and controls the on/off of the electrical device accordingly. For signals with high real-time requirements, the PLC can issue an interrupt to the NC via the ISA bus after updating the contents of the dual-port RAM.

Here, the dual-port RAM is used to complete the information exchange between the NC and the embedded PLC, compared with the scheme using the parallel port. The method is simple and clear, no complicated communication protocol is required, and the NC can keep track of the state of the external device without any additional time. Efficiency is higher than other implementations.

Figure 1 includes a piece of static RAM chip 6264, powered by a backup battery - primarily used to store PLC ladder programs. The electrical control logic is programmed in the NC, compiled and stored in the 6264 via the dual port RAM. The PLC runs this part of the program. Complete electrical control.

2 software design

The embedded PLC software design has two parts, one is the related program design in the industrial PC, and the other is the monitoring program design of the embedded PLC itself. The main function module of the former is shown in Figure 2.

Design of embedded plc in machine tool numerical control system

The ladder programming module provides the user with convenient PLC electrical control logic programming means, and the generated result is a ladder file. The ladder file only stores the logical relationship between the I/0 points. The format is independent of the CPU type used by the embedded PLC to improve the adaptability and reusability of the programming module. The ladder compilation module is used to convert the file into a series of 80C196 machine instructions, and add some necessary additional instructions to generate a BIN file, ie a machine code file. This part should take into account the resource distribution of the I/O points in the PLC, so that the instructions of the last generated BIN file are coordinated with the actual I/O resources. The communication module is used to transfer the BIN file to the dual port RAM, which is then dumped to the 6264 by the PLC monitor. This section provides a user development interface to allow the user to control the transfer of BIN files and provide the user with the ability to program the PLC in the field. The monitoring module provides functions such as user I/O point monitoring and setting, PLC running status/programming status setting, etc., which is convenient for on-site debugging. In addition, this part also provides an open user interface in order to enable users to effectively monitor embedded PLCs in self-developed applications.

The embedded PLC monitoring program mainly implements the following functions: the logic processing program in 6626 (that is, the BIN file transmitted from the industrial computer) and the validity check of the running status, and the periodic refresh of the I/O point and the dual port RAM mapping area. Operation fault monitoring, panel button detection, etc. When a valid BIN file already exists in the 6264 and a valid run flag has been set, the logic handler in Run 6264 is started. Also ask at runtime. Use Watch Dog to monitor whether the operation is normal. Prevent and handle exceptions such as timeout errors when running a program in 6264, errors in logic handlers in 6264, etc. The advantages of this system design are summarized as follows:

Design of embedded plc in machine tool numerical control system

(1) With plug-in design, there is no redundant wire connection between NC and PLC, high reliability and real-time guarantee.

(2) Use two-port RAM for information exchange. Fast speed and simple lines.

(3) Embedded in the machine system. Easy to develop, debug, use and maintain. It is convenient to form a more complicated system with the user's software and hardware.

3 Using embedded PLC in CNC system

As mentioned earlier. There are three types of methods for electrical control of CNC machine tools. Namely: external PLC, virtual PLC and embedded PLC. If the conventional programming method is adopted, the above three electrical control methods are used. It is necessary to design different software interfaces, and the main body of the CNC system software will directly relate to the implementation of electrical control and its details. Once the control method changes, you will have to make a lot of changes to the software. The software thus written is poorly versatile and difficult to adapt to changes in order to increase the independence between software and devices. We use object-oriented technology to open the system.

Obviously, the goal is the same regardless of the control method. After careful analysis, we found out the commonalities of the three questions, and thus derived an abstract class CPLC, which provides all the external features of the CNC machine tool electrical control, providing a complete interface function for the CNC system main software, CNC Other parts of the system can make the corresponding action of the electrical switch by simply calling the corresponding interface function. However, this part does not cover details during electrical operation. Considering that there are many electrical control points in the numerical control system, designing an interface function for each control action such as hydraulic opening, hydraulic closing, etc. will lead to too many interface functions, and the application is inconvenient. Therefore, we have designed a universal interface. Function, which is defined as follows:

Design of embedded plc in machine tool numerical control system

If the hydraulic switch number is defined as 1, the cooling switch number is 2, ...,

Then the hydraulic function call is

Based on the abstract class CPIC, the derived classes CExternalPlc, CVirtualPLc and CEmbedPLc are defined for the three methods. In these classes, the interface functions are actually programmed to complete the hardware operations. The electrical control portion software obtained according to this design idea has the structure shown in FIG. It can be seen from Fig. 3 that this design method adds an abstract class hierarchy between the main software of the numerical control system and the electrical control hardware, which weakens its interdependence and becomes two relatively independent parts. The numerical control system software obtained by this method has device-independent features when new hardware devices appear. Simply derive a new class from the original abstract class and interpret the interface function according to common criteria. Manipulating the hardware to make the appropriate action, without any modifications to the rest of the software. Mrs. has improved the efficiency of software design. Actually. After a clear specification of the meaning of the interface function parameters, anyone else can refer to the specification to design new electrical control hardware and corresponding drivers, integrated into the human system. This is the main purpose of the open design of CNC systems.

4 Conclusion

The knowledge of the open design designer of the CNC system is closely related to the station. Only by fully understanding the existing design technology and user needs, and making predictions about its development in the near future, it is possible to obtain a complete and open CNC system based on engineering design methods. The current discussion of openness focuses on the hardware architecture of the system. Operating system and development environment. How to achieve openness, especially the openness of software, is rarely discussed. This paper has an open design of the electrical control subsystem from hardware to software. This has been a useful exploration. This subsystem has been integrated into the five-axis linkage CNC system we developed. From the perspective of the use effect, its open interface standard and device-independent software design help to reduce errors when writing the main software of the CNC system, and have strong adaptability and reliability.

Car Vacuum Cleaner

Mini Car Vacuum Cleaner,Cordless Car Vacuum Cleaner,Car Cordless Vacuum Cleaner,Rechargeable Car Vacuum Cleaner

Ningbo ATAP Electric Appliance Co.,Ltd , https://www.atap-airfryer.com