Preface
Programmable controller (PLC) is highly reliable and easy to use when controlling the switch signal of machine tools. It is widely used in most CNC machine tools, especially economical CNC machine tools, when the number of input and output points required is small. In the case of using PC system resources, the time-sharing of Windows is adopted, and the development purpose of the real-time environment is not considered. The efficiency of its system call is not high, and it cannot meet the real-time requirements of PLC control in high real-time occasions of CNC systems.
As a high-performance, scalable embedded real-time operating system running on the target machine, VxWorks is currently widely used in communications, military, aviation, aerospace and other high-tech and real-time demanding fields due to its good reliability and excellent real-time performance.
Based on the VxWorks operating system, this paper proposes a method and application for designing an embedded real-time PLC based on VxWorks. It utilizes the openness, modularity, and scalability of the system structure characteristics of VxWorks as well as the multi-threaded/multi-tasking system environment to achieve PLC control with high real-time requirements, while ensuring real-time performance, and realizing the control goals of a multi-point, complex-function PLC system.
1. Structure of traditional PLC system
Compared with the traditional industrial PLC based on general industrial PC, the embedded PLC hardware of its numerical control system includes: industrial computer and its peripherals, switch input and output interface card based on ISA bus, photoelectric isolation module, relay output module. Its structure is shown in Figure 1.
The industrial computer uses non-real-time operating systems such as Windows. The human-machine interface, CNC code processing, trajectory planning, parameter management and PLC control of the CNC system are all implemented by software through the industrial computer. There is no need for an independent NC controller, which reduces the dependence of the CNC system on hardware and is conducive to improving the openness of the system. I/O input and output information is exchanged between the host and the servo interface module and the I/O interface module through the PC I/O interface card. The PC I/O interface card is based on the ISA or PCI bus. Although it has added industrial PCs to expand its openness compared to the original single-chip control, it does not fully utilize PC system resources. When developing and running non-real-time multitasking operating systems (such as Windows, Linux), its design does not take into account the development purpose of the real-time environment. The efficiency of its system call is not high, and the PLC control of the CNC system cannot meet the real-time requirements of some high-precision occasions.
2. Real-time PLC system structure based on embedded system
Embedded real-time PLC system generally consists of two parts: development system and real-time operation system. They are two independent but inseparable systems that can be run separately. The development system is based on PC and built on the Windows operating system platform, providing the writing and compilation and debugging environment of PLC application programs. The communication between the development system and the real-time operation system is generally realized through the RS232 interface. If the embedded operating system provides network services, it can also communicate through Ethernet, Modbus or CAN bus. After the application is written and compiled and debugged correctly, it is downloaded to the embedded system through RS232 or TCP/IP communication protocol. The real-time operation system is used to complete system configuration, input signal processing, cyclic calling of PLC programs and control signal output, and can communicate with the hardware layer (I/O) through fieldbus or TCP/IP communication protocol.
In order to better support real-time operating systems, embedded systems generally need to introduce operating systems. Embedded operating systems (such as Windows CE, VxWorks, etc.) provide real-time operating systems with services such as startup code, serial communication interface, memory operation (malloc/free), ANSI standard library, 1ms clock tick, debugging interface, etc. If the real-time operating system integrates the corresponding functions, the system can also not introduce an operating system. The embedded real-time system architecture we use is shown in Figure 2, and its real-time operating system uses VxWorks.
The communication performance and real-time capability are greatly improved. At the same time, this structure is completely open, highly compatible, and has excellent scalability, so that the design of the automatic control system is not limited by hardware, which can effectively improve the operation speed and reliability of PLC and support multi-task control strategies. In addition, corresponding optimization has been done in terms of embedded processing design and BSP transformation.
3. Design of embedded processor based on PPC
The VxWorks system runs on the MPC860 processor based on PPC, and some modifications have been made to adapt to the communication requirements of the field bus of the real-time PLC. It mainly includes four main modules (as shown in Figure 3): PowerPC core, system interface unit (SIU), communication processing module (CPM) and fast Ethernet controller (FEC).
The system interface unit (SIU) integrates almost all common functions of 32-bit processor systems. MPC860 uses a 32-bit internal bus and can support 8, 16 or 32-bit peripherals and memories. At the same time, SIU provides power management, reset control, PowerPC subtractor, PowerPC clock reference and real-time clock functions. Its memory controller can control up to 8 storage bodies, and can achieve seamless connection with DRAM, SRAM, Flash and other peripheral devices through only a few circuits. At the same time, the DRAM interface supports 8, 16 and 32-bit ports, and the DRAM controller provides burst transfer access in page mode; it provides 4 16-bit general-purpose timers or 2 32-bit timers; at the same time, the system integration unit integrates bus monitoring, software watchdog, system power saving mode, clock synthesis, real-time clock, reset control and supports IEEE 1149.1 debugging mode JTAG.
The Communications Processing Module (CPM) has more powerful communications processing capabilities and has an independent simple instruction set communications processor (RISC) that can complete low-level tasks and DMA control, allowing the PowerPC core to be free to handle high-level real-time tasks, thereby reducing system frequency and power consumption.
The embedded FEC module is compatible with IEEE 802.3 and supports 10- and 100-Mbps connections. It not only completes the MAC control function in the Ethernet protocol, but also uses burst transfer DMA to reduce the load of the system bus. The receive and transmit FIFOs inside the FEC further reduce the load of the bus by localizing all conflicts to the FEC. FEC uses independent transmit buffer descriptors and receive buffer descriptors to complete specific transmit and receive access. It can support field bus applications such as Modbus, CAN, and EIP.
4. BSP transformation
BSP stands for Board Support Package, which usually refers to a collection of startup codes and some device drivers written by users for a specific hardware platform. BSP is the basis for the operation of a VxWorks kernel. 4.1 The hierarchical relationship between BSP and VxWorks In VxWorks, BSP is simply described as a software interface between the underlying hardware environment and VxWorks. Its main function is to initialize the target hardware after the system is powered on, initialize the OS, and provide drivers for some hardware such as clocks, interrupts, serial port drivers, etc. The relationship between it and the kernel, drivers and applications is shown in Figure 4:
As shown in the figure, BSP is a bridge for interaction between upper-layer software and underlying hardware, providing a unified interface for the upper layer. The drivers included in BSP are related to specific hardware. When porting to different hardware systems, the relevant drivers need to be modified.
4.2 Features of VxWorks BSP
Among the many commercial embedded real-time operating systems, VxWorks is an extremely widely used operating system. It has strong real-time performance, occupies little space, provides rich network protocols, and has numerous debugging methods.
VxWorks BSP can be divided into two parts according to its functions.
1) System boot part of the target system: mainly hardware initialization when the target system starts, starts to execute after the target system is powered on, mainly to configure the working status of the processor, initialize the system's memory, etc. This part of the program is generally only executed when the system is booted to provide a hardware environment for the operating system to run.
2) Device drivers of the target system: mainly drive various devices configured in the target system, including character devices, block storage devices, network devices, etc. These device drivers complete the configuration of the hardware. The operating system accesses the hardware through the device driver to complete data reading and external interaction.
In actual applications, in order to obtain better stability and execution efficiency, many device drivers are directly bundled with applications instead of being managed by the operating system.
4.3 Design and modification of BSP
WRS provides a large number of pre-made BSPs that support many commercial main boards or evaluation boards, reducing development time.
From a macro perspective, BSP consists of two parts:
Initialization part: CPU initialization; target board initialization; operating system initialization.
Driver program part: generally includes clock, interrupt, and serial port driver.
Specifically, BSP includes source files, header files, and derived files. You mainly need to modify the following directories in the VxWorks source code:
/target/config/all
The functions of several important files are as follows:
1)bootConfig.c: The main initialization and control file for the boot ROM image.
2) bootInit.c: The second stage initialization code of the boot ROM image. Implement the romStart function - after the romInit() function in romInit.s is executed, it jumps to romStart() to perform decompression and copy the code/data segment from rom to ram.
3)usrConfig.c: The main initialization code of the VxWorks image.
/target/config/comps/vxworks: Real-time kernel basic module description (cdf) file.
/target/config/comps/src: Real-time kernel module configuration file. Used by usrconfig.c.
/target/config/bspname The files in this directory are the BSP files to be written.
Due to the hardware relevance of BSP system development and the diversity of processor series, it is impossible to have a universal program or method to solve the BSP problem of each processor. Therefore, specific analysis of specific problems and continuous practice are required to make the program run with relatively high efficiency.
5. Summary and Outlook
Embedded systems have become an inevitable trend in the development of history. They have excellent scalability, support for a variety of hardware, and can improve the speed and reliability of PLCs. They also support multi-task control strategies, which greatly improves the performance of PLCs. The new embedded real-time PLC based on VxWorks has a high performance-price ratio and market competitive advantages, which will help Chinese PLC companies develop their domestic market and develop independent industry PLCs.
Previous article:S7-200 simple analog programming program
Next article:Implementation scheme of virtual touch screen system
- Popular Resources
- Popular amplifiers
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- Focusing on promoting innovation and transformation, UHV field creates more possibilities in the era of clean energy
- Infineon Technologies Launches SECORA™ Pay Green, World’s First Contactless Payment Card Technology, Reducing Plastic Waste by Up to 100%
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?