| Currently,programmable controller has been widely used in the field of industrial control.Embedded programmable controller,which is based on embedded chip,has flexible hardware structure and short development cycle also is easy to use compared with traditional programmable controller.It's broadly recognized domestically and abroad.It is easy to implement complex control programs using structured text(ST),which is a common programming language of programmable controllers.Therefore,this paper designs and implements a ST development tool for embedded programmable controllers.A method of translating ST language to C language,which is a common language in embedded devices,is proposed as well to improve the compatibility of development tools with embedded programmable controllers.This paper focuses on the design and implementation of the ST development tool and the compiler module.The specific contents are listd as following:1)To achieve the ST compiler front-end design,common elements and ST program structure specified in the IEC 61131-3 standard are deeply studied.It mainly describes the lexical rules and grammar rules of the ST language,also constructs and analyzes the ST abstract syntax tree.2)For the ST compiler back-end design,this paper defines transformation rules between ST language and C language and designs memory mapping rules according to the memory characteristics and the hardware structure of the programmable controller.In order to describe the special Program Organization Units(POUs)of programmable controllers,this paper uses C language to implement the ST standard function and function block.3)ST language supports time literal.This paper takes the timer as an example to construct the timed automata model of ST program and C program,and uses the model-checker UPPAAL for formal verification to ensure the consistency of functions before and after conversion.4)Realize the design of ST development tool,and verify the correctness and feasibility of the proposed method through PID control examples and a series of test cases. |