摘要
介绍了软PLC开发系统的构成和功能,并针对梯形图编辑到目标代码生成的过程,论述了编辑模块、编译模块和仿真模块的设计方案。首先,利用Visual Studio 2005建立梯形图编辑界面和梯形图组件库,实现组件调用和梯形图编辑功能;其次,根据梯形图的构成特点,通过一定的扫描规则来构成二叉树,并通过后序历遍算法来获得指令表;然后,为了实现编辑环境和运行环境的高效通信,通过查表的方式将指令表转换为较为简单的目标代码;最后,建立仿真环境来验证编程的正确性。
The structure and function of the soft PLC development system is introduced.The design of editing module,compiler module and simulation module is discussed for the process from the ladder diagram editing to the object code generation.The ladder diagram editing interface and component library are built with Visual Studio 2005 to realize the functions of component call and ladder diagram editing.A binary tree is constituted according a certain rule and the characteristics of ladder diagram.The instruction list is achieved from the binary tree by postorder traversal algorithm.The instruction list is transformed to the simple target code through looking up conversion table.The simulation module is built to verify the correctness of the programming.
出处
《现代电子技术》
2012年第10期15-17,20,共4页
Modern Electronics Technique
基金
国家863计划资助项目(2009AA04Z111)
广东省重大科技专项项目(2010A080401006)
关键词
软PLC
梯形图
指令表
二叉树
soft PLC
ladder diagram
instruction list
binary tree