Font Size: a A A

High-level Language Design And Implementation Of Embedded Motion Controller

Posted on:2006-09-25Degree:MasterType:Thesis
Country:ChinaCandidate:D ChenFull Text:PDF
GTID:2192360155466943Subject:Mechanical Manufacturing and Automation
Abstract/Summary:PDF Full Text Request
The language for motion control and its compiling system are the key fundamental technology of embedded motion controller, which have big effects on the performance of motion controller. The traditional language for motion control can't meet the demand for development of the open architecture motion controller. Developing a high-level language, which has instructions for motion control and PLC's logic control, and realize its compiling system are of great value.This thesis presents a definition of a new language for motion control on the basis of researching other languages for motion control and for PLC control. The new language is named EP (Easy to Program). The regular grammar is used to represent the lexical structure of EP. The context-free grammar is used to represent the syntax of EP. The semantics of EP are defined in Chinese character description. Ultimately, EP is defined exactly. Supporting a C-like structure, EP includes a number of PLC-specific instructions and motion-specific keywords, which allow control of motor position, speed, digital input and so on.The compiling system of EP is composed of compiler in industrial computer and interpreter in motion controller. The compiler compiles the source program and form file of target code like file of Java bytecode. The target code is interpreted and executed after download from PC to motion controller is completed. The compiler works on PC with windows2000 operating system. The interpreter works on motion controller with uC/OS-II embedded operating system. The interpreter and uC/OS-II operating system constitute virtual machine, which makes EP language easy to replant to other motion controllers.The compiler of EP consists internally of lexical scanner module, parser module, semantic analyzer, target code generator module, symbol table management module and error handle module. The scanner performs lexical analysis on source program and output a sequence of tokens. Adopting bottom-up parsing algorithms, the parse analyse the sequence of tokens and form the syntax tree of EP program. In semantic analysis, the symbol table can be built by a preorder traversal of the syntax tree, and the type checking can be performed by postorder traversal. The target code generator generates different snippet of target codes according to different type nodes by deep traversal of the syntax tree. Finally, all snippets form the whole target code program. The data structure of syntax tree adopts unilateral chained list to realize, and the data structure of symbol table adopts hash tables. It is through testing that the compiler can generate target code accurately and rapidly.The interpreter in motion controller includes getting instructions module and interpreting & executing instructions module. The runtime environment of interpreter is stack-based. In stack, the global/static area may be further divided into event entrance address area, I/O ports and axes information area, global variables area. The ascending order of priority about interpreter task and other relevant tasks is: the task of I/O port scanning, the task of keyboard scanning and text display, the task of communication and the task of interpreting.EP language has integrated development system, EP Compiler, with friendly graphic interfaces. In EP Compiler, EP program can be edited, compiled, managed, downloaded and debugged. The error information can also be shown. EP Compiler makes the EPlanguage easy to use.
Keywords/Search Tags:motion control, PLC logic control, high-level language, compiler, interpreter
PDF Full Text Request
Related items