| PLC is widely used in modern automation industry.With the development of new technologies such as ARM and FPGA,the PLC is designed with ARM or FPGA,and ARM + FPGA.According to a small PLC,which is being developed by the project team,we use STM32F407IGT6 and EP4CE10F17C8 N as the new core controller to carry out the optimization of the software platform and hardware circuit of the original PLC system in this design,the main achievements are as follows:(1)Building and optimization of the software platform.Firstly,the μCOS-Ⅱ operating system is transplanted on the STM32F407 according to the μCOS-Ⅱ architecture and the Micrum Example.Then,the task management function of the system is tested and the PLC system thread model is designed.Finally,Mutex semaphore and message queue are applied to optimize the synchronization and communication between the PLC system tasks,block memory management is taken use of to optimize the μCOS-Ⅱ's memory management function,rewrite the OSSTart High Rdy assembly function.(2)Optimization of PLC source program downloading mode and memory space allocation.Aiming at improving the transmission efficiency of the source program between the upper computer programming system and the PLC running system,the number of valid data bytes in the data frame format is increased to 512 bytes and the UART IAP transmission mode is designed as UART DMA mode.The FLASH space and RAM space on the ARM side are reasonably divided.To avoid the conflict between the PLC system stack data and the μCOS-Ⅱ's running space,μCOS-Ⅱ's heap memory is planned to 64 KB CCM on-chip SRAM,with improving the overall efficiency of the PLC system.(3)Based on the FSMC bus of STM32F407,the ARM-FPGA communication bus interface circuit and its read and write timing are designed,and the FPGA-side dual-port RAM address space is properly programmed.According to the instruction format of the FPGA function module,combined with the PLC host running status,the characteristics of ARM and FPGA executing the instruction sequence,the principle of ARM side instruction design is put forward and the instruction format send to the FPGA by the ARM side is designed.The transistor and relay output circuit is designed,PLC system and CAN function module power supply is optimized.(4)Functional application test of PLC system.UART DMA download mode is verified by monitoring the data exchange process between PC programming system and PLC running system.Take the instruction format designed by the project group into consideration,the ladder program of the automatic plastic hollow forming machine and its instruction list program are recorded into the host computer programming system to verify the correctness of the system function.Through data operation of the dual-port RAM,the correct communication between ARM and FPGA is verified.Write PLC input acquisition and output refresh program to verify that their function is correct. |