| Embedded PLC implements the function of control software of traditional PLC in a specific embedded system, and also expands the functions of PLC with extra features: it runs high performance real-time operating system, thus concentrating on the exectuting of control software whiling leaving the hardware management to the operating system itself. Therefore it keeps hardware management and industrial control software separate, just like the PLC does; Embedded systems can be tailor-made, so it has the characters of single chip systems such as individuation and diversity; Due to the growth of computing power of embedded processors, the gaps between the capability of network access, implementing GUI and computing power of embedded systems and those of IPCs(Industrial PCs) is closing fast.This dissertation utilizes the compiling and debugging tools provided by an open source project– GNU to build a convenient cross compiling environment for the software development of embedded PLC. Programmers can write and compiles source codes on a PC and then mount the compiled programs on the embedded develop board for test runnings and debuggings through NFS.Based on the analysis of hardware structure and mechanism of the control software of PLC, this dissertation implements a double-layer embedded PLC structure– embedded PLC consists of a CPU core board and a peripheral interface board. In different applications, only the peripheral interface board needs to be changed in order to meet the specific control requirements, while the operating system and application software on the CPU core board requires minimum justification. Thus the cost of developing and application is reduced, the stability and reliability of the system are ensured, tha adaptability of the system is enhanced. 130 S3C2440A on-chip GPIO ports are used for on-off inputs and outputs control, and S3C2440A on-chip A/D converter is used for basic analog inputs. I2C bus can be used in case there requires more I/O ports for on-off and analog I/O control. The S3C2440A on-chip touch screen controller makes the integrating of CPU module and external programmer of traditional PLC possible, the device driver for it is implemented in this dissertation. Embedded PLC uses standard Linux as it operating system. The real-time capability of Linux(ver. 2.6.13) is improved by the following methods: A mechanism called"Entering a critical section is allowed only if the operation finishes before the execution of next real-time task"is introduced, together with the implementation of"Ceiling Priority Protocol"and using the kernel thread to replace the normal ISR. Thus the priorities of real-time tasks are ensured, the"Priority Inversion"situations are avoided and the interrupt latency is short and predictable. The control mechanism of GPIO ports is implemented in a kernel module and linked into the Linux kernel. Engineers are allowed to choose the proper control mechanism accordingly. |