基于单片机的PLC编译程序设计研究毕业设计论文(1).doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《基于单片机的PLC编译程序设计研究毕业设计论文(1).doc》由会员分享,可在线阅读,更多相关《基于单片机的PLC编译程序设计研究毕业设计论文(1).doc(62页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、毕业设计(论文)题目:基于单片机的PLC编译程序设计研究目 录摘 要6关键词6Abstract7Key words8前 言81 基于单片机的PLC的单片机程序模块研究及其目标程序框架的构建91.1 基于单片机的PLC常用的单片机程序模块的构建91.2 基于单片机的PLC的TIM Ti语句的单片机程序模块构建10121 围绕TIM Ti片内硬件资源的配置1012. 2 TIM Ti所需的To中断服务程序11123 TIM Ti模块的流程分析和建立1213 CNT Ci 语句的单片机程序模块的构建1314 PLS8 Yi 脉冲微分语句的单片机程序模块的构建141. 5 移位类语句的单片机程序模块的
2、构建151. 6 基于单片机的PLC目标程序框架的构建162 基于单片机的PLC编译程序总体设计方法1921 采用数组技术构建基于单片机的PLC源程序语句标准集合19211 基于单片机的PLC源程序语句标准集合的定义19212 基于单片机的PLC源程序语句标准集合的数组表达2022 基于单片机的PLC目标代码集合的构建2223 建立基于单片机的PLO源程序语句和目标代码之间的关系2224 基于单片机的PLO编译程序结构2325 盲码的预先填入及修正技术233 基于单片机的PLC编译程序查错模块设计2431 编译过程中列表文件名和列表文件的建立24311 用STRCAT建立列表文件名25312
3、列表文件(1st)的建立253. 2 查错模块程序流程2633 整句识别2634 语句语法检查27341 M数组逐行搜索28343 核对语句长度是否正确29344 错误标记写入错误信息文件3035 查错模块程序运行结果304 固定代码的装配3041 基于单片机的PLC编译过程中目标文件的建立31411 目标文件名的建立31412 目标文件(Bin)的建立3242 建立固定代码数组3243 向目标文件中装配固定代码345 活动代码的翻译和装配3451 活动代码翻译和装配的整体思路3452 源程序语句的类型识别35521 ckhh存放着当前被翻译的源程序语句36522 当前源程序语句的类型识别36
4、53 简单活动代码的装配37531 引用名(位地址)字符转化函数cvt(x,y)的定义37532 实现映射F i=口(Mi)的第一种程序结构38533 LDI语句的目标代码装配38534 AND语句的目标代码装配39535 ANI语句的目标代码装配39536 OR语句的目标代码装配40537 ORI语句的目标代码装配40538 STORE语句的目标代码装配41539 OUT语句的目标代码装配4154 复杂活动代码的装配及其盲码的修正42541 TIM语句的目标代码的装配及其盲码的修正425411 TIM模块中的F数组赋值435412 TIM模块中第二种盲码的修正445413 针对TIM的第一种
5、盲码的修正445414 目标文件Bin装配时两种地址的切换方法4554. 15 TIM模块的目标代码装配46542 CNT语句的目标代码的装配及其盲码的修正465421 CNT模块中的F数组的赋值485422 CNT模块的目标代码装配48543 RSTC语句的目标代码的装配及其盲码的修正485431 RSTC语句翻译模块中的盲码修正495432 RSTC模块中F数组的赋值和目标代码的装配49544 PLS语句的目标代码的装配及其盲码的修正505441 PLS语句翻译模块中的盲码修正515442 PLS模块中F数组的赋值和目标代码的装配51545 DIN语句的目标代码的装配及其盲码的修正5154
6、51 DIN语句翻译模块中的盲码修正525452 DIN模块的目标代码装配52546 SFT语句的目标代码的装配及其盲码的修正535461 SFT语句翻译模块中的盲码修正535462 SFT模块中F数组的赋值和目标代码的装配54547 RSTS语句的目标代码的装配及其盲码的修正545471 RSTS语句翻译模块中的盲码修正555472 RSTS模块中F数组的赋值和目标代码的装配5555 END语句的处理566 基于单片机的PL c编译程序的实验研究5661 实验研究系统的建立5662 基于单片机的PLO源程序的编辑和编译5763 结论58参考文献59致谢61基于单片机的PLC编译程序设计研究摘
7、 要自动化装置和机电一体化产品的设计和开发中有时需要采用一种成本极低的逻辑控制器。为了满足这种需要,作者开展了用单片机直接实现梯形图逻辑控制的硬件和软件研究。其中最为关键的一项技术是如何设计出基于单片机的PLC编译程序,将符合梯形图逻辑的PLC指令源程序翻译成单片机目标程序。本文论述了基于单片机的PLC编译程序设计的理论和方法,研究了基于单片机的PLC的单片机程序模块和目标程序框架,对编译程序结构进行了分析,阐述了查错模块设计方法以及目标代码装配方法,对基于单片机的PLC的编译程序的调试实验系统组成和实验结果进行了分析。首先,进行了基于单片机的PLC的单片机程序模块研究,构建了独具特点的目标程
8、序框架结构。然后,定义了基于单片机的PLC的源程序语句标准集合,提出了源程序语句标准集合的数组表示方法;定义了目标代码集合,提出了用口映射来建立源程序语句标准集合和目标代码集合之间的关系,为编译程序结构的实现提供了条件和方法;提出了盲码预填和盲码修正的思想提出了依据M数组对源程序查错的思路,通过列表文件名和列表文件的建立、整句识别、语句语法检查中的M数组逐行搜索、核对关键词是否相等、核对语句长度是否正确等一系列环节,实现对源程序的查错处理;论述了翻译过程中向目标文件里装配固定代码的过程;论述了翻译和装配活动代码的整体思路和流程;运用M数组进行源程序语句的类型识别,初步实现了盯映射的预定位;有效
9、定义了引用名(位地址)的字符转化函数;分别给出了实现盯映射的第一种程序结构和第二种程序结构,有效的完成了简单活动代码和复杂活动代码的翻译和目标文件的装配任务;提出并论述了第一类盲码修正和第二类盲码修正的程序实现方法。建立了基于单片机的PLC的编译程序设计研究的实验系统,对该编译程序的各项功能进行了验证和比对。经过多个程序的试验表明,该编译程序能够正确地将基于单片机的PLC源程序翻译成单片机可以直接执行的、符合梯形图逻辑控制要求的目标程序。实验结果表明,本文所设计的基于单片机的PLC编译程序完全符合设计要求,可以用于项目开发。由于基于单片机的PLC成本极低,实际应用时可以带来较好的经济效益,因而
10、具有较强的实用性。关键词: 单片机,可编程逻辑控制器,编译程序,盲码,源程序,目标程序Abstract Sometimes,one kind of extremely inexpensive logic controller is needed in design and the development of the automation device and the integration oelectromechanical productIn order to meet this kind of needsthe author carried Oll the hardware and t
11、he sofhvare research of having directly realized the ladder diagram logic control with the monolithic microcomputerIn whichmost essential technology is how to design the compiler for PLC based on monolithic microcomputer,and is how to translate PLC instruction source program which conf01Tn ladder di
12、agram logic into monolithic microcomputer targetprogramThis paper elaborated design theory and the method of the compiler for PLC based on the monolithic microcomputer,has studied the monolithic microcomputer program module and the target program frame for PLC based on the monolithic microcomputer,h
13、as c ried on the analysis to thecompiler.structureelaborated design method for the checking mistaken module as well as the assembly method for goal code,has carried on the analysis to expedmental result and debugging experiment system composition for the compiler for PLC based on the monolithicmicro
14、computerFirst,the research on the monolithic microcomputer program module for PLC based on the monolithic microcomputer has been conductedThe alone characteristic frame construction for targetprogram has been constructedThenthe paper has defined the standard set of the source program sentence for PL
15、C based on the monolithic microcomputer,proposed the array expression method for the standard setof the source program sentenceThe goal code set has been definedEstablishing the relations between the source program sentence standard set and the goal code set with sigma the mapping has been proposed,
16、so that the condition and the method for realization of the compile structure has been providedA thought ofthe filling blind code in advance and the revising blind code has been proposed。A mentality of checking mistaken to the source program according to the Marray has been proposedThe processing of
17、 the checking mistaken to the source program has been realized through a series of procedure such as the establishment of list filename and list documenL the recognition to entire sentencethe search by line using M array in sentence grammar inspection,the checkup to key word whether equal,the checku
18、p to sentence length whether correct and so onThe process of assembling the fixed code into the goal document during the translation has been elaboratedOverall mentality and the procedure of the translation and the assembly code have been elaboratedThe pre-localization of the sigma mapping bycarryin
19、g on the type recognition to source program sentence depend on the array M has initially beenrealizedThe character transformation function for quotation name(bit address)has been definedeffectively,e first kind of procedure structure and the second kind of procedure structure for realizationsigma ma
20、pping has separately been given,so that the translation of the simple active code and the complex active code has effective been completed,and that the assembly of the goal document has been completedThe procedure realization method for the first kind of blind code revision and the second kind of bl
21、ind code revision has been proposed and elaboratedThe experimental system which using the research of compiler design for PLC based on monolithic microcomputer has been establishedWe had carried on the confirmation and compare to the each function of the compilerAfter the severaI procedure trials。in
22、dicated that the compiler can translate correctly thesource program of PLC based on monolithic microcomputer into the target program which is enable to be executed by monolithic microcomputer and tallies the request of ladder diagram logic contr01The experimental result proved that the compiler desi
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 基于 单片机 PLC 编译 程序设计 研究 毕业设计 论文
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内