基于单片机的plc编译程序设计研究Word文件下载.docx

上传人:b****2 文档编号:14897052 上传时间:2022-10-25 格式:DOCX 页数:57 大小:318.98KB
下载 相关 举报
基于单片机的plc编译程序设计研究Word文件下载.docx_第1页
第1页 / 共57页
基于单片机的plc编译程序设计研究Word文件下载.docx_第2页
第2页 / 共57页
基于单片机的plc编译程序设计研究Word文件下载.docx_第3页
第3页 / 共57页
基于单片机的plc编译程序设计研究Word文件下载.docx_第4页
第4页 / 共57页
基于单片机的plc编译程序设计研究Word文件下载.docx_第5页
第5页 / 共57页
点击查看更多>>
下载资源
资源描述

基于单片机的plc编译程序设计研究Word文件下载.docx

《基于单片机的plc编译程序设计研究Word文件下载.docx》由会员分享,可在线阅读,更多相关《基于单片机的plc编译程序设计研究Word文件下载.docx(57页珍藏版)》请在冰豆网上搜索。

基于单片机的plc编译程序设计研究Word文件下载.docx

基于单片机的PLC编译程序设计研究

 

学生姓名:

学号:

学部(系):

机械与电气工程学部

专业年级:

电气工程及其自动化

指导教师:

职称或学位:

年5月30日

摘要

自动化装置和机电一体化产品的设计和开发中有时需要采用一种成本极低的逻辑控制器。

为了满足这种需要,作者开展了用单片机直接实现梯形图逻辑控制的硬件和软件研究。

其中最为关键的一项技术是如何设计出基于单片机的PLC编译程序,将符合梯形图逻辑的PLC指令源程序翻译成单片机目标程序。

本文论述了基于单片机的PLC编译程序设计的理论和方法,研究了基于单片机的PLC的单片机程序模块和目标程序框架,对编译程序结构进行了分析,阐述了查错模块设计方法以及目标代码装配方法,对基于单片机的PLC的编译程序的调试实验系统组成和实验结果进行了分析。

首先,进行了基于单片机的PLC的单片机程序模块研究,构建了独具特点的目标程序框架结构。

然后,定义了基于单片机的PLC的源程序语句标准集合,提出了源程序语句标准集合的数组表示方法;

定义了目标代码集合,提出了用口映射来建立源程序语句标准集合和目标代码集合之间的关系,为编译程序结构的实现提供了条件和方法;

提出了盲码预填和盲码修正的思想提出了依据M数组对源程序查错的思路,通过列表文件名和列表文件的建立、整句识别、语句语法检查中的M数组逐行搜索、核对关键词是否相等、核对语句长度是否正确等一系列环节,实现对源程序的查错处理;

论述了翻译过程中向目标文件里装配固定代码的过程;

论述了翻译和装配活动代码的整体思路和流程;

运用M数组进行源程序语句的类型识别,初步实现了盯映射的预定位;

有效定义了引用名(位地址)的字符转化函数;

分别给出了实现盯映射的第一种程序结构和第二种程序结构,有效的完成了简单活动代码和复杂活动代码的翻译和目标文件的装配任务;

提出并论述了第一类盲码修正和第二类盲码修正的程序实现方法。

建立了基于单片机的PLC的编译程序设计研究的实验系统,对该编译程序的各项功能进行了验证和比对。

经过多个程序的试验表明,该编译程序能够正确地将基于单片机的PLC源程序翻译成单片机可以直接执行的、符合梯形图逻辑控制要求的目标程序。

实验结果表明,本文所设计的基于单片机的PLC编译程序完全符合设计要求,可以用于项目开发。

由于基于单片机的PLC成本极低,实际应用时可以带来较好的经济效益,因而具有较强的实用性。

关键词:

单片机,可编程逻辑控制器,编译程序,盲码,源程序,目标程序

Abstract

Sometimes,onekindofextremelyinexpensivelogiccontrollerisneededindesignandthedevelopmentoftheautomationdeviceandtheintegrationoelectro—mechanicalproduct.Inordertomeetthiskindofneeds.theauthorcarriedOllthehardwareandthesofhvareresearchofhavingdirectlyrealizedtheladderdiagramlogiccontrolwiththemonolithicmicrocomputer.Inwhich.mostessentialtechnologyishowtodesignthecompilerforPLCbasedonmonolithicmicrocomputer,andishowtotranslatePLCinstructionsourceprogramwhichconf01Tnladderdiagramlogicintomonolithicmicrocomputertargetprogram.ThispaperelaborateddesigntheoryandthemethodofthecompilerforPLCbasedonthemonolithicmicrocomputer,hasstudiedthemonolithicmicrocomputerprogrammoduleandthetargetprogramframeforPLCbasedonthemonolithicmicrocomputer,hascriedontheanalysistothecompiler.structure.elaborateddesignmethodforthecheckingmistakenmoduleaswellastheassemblymethodforgoalcode,hascarriedontheanalysistoexpedmentalresultanddebuggingexperimentsystemcompositionforthecompilerforPLCbasedonthemonolithicmicrocomputer.First,theresearchonthemonolithicmicrocomputerprogrammoduleforPLCbasedonthemonolithicmicrocomputerhasbeenconducted.Thealonecharacteristicframeconstructionfortargetprogramhasbeenconstructed.Then.thepaperhasdefinedthestandardsetofthesourceprogramsentenceforPLCbasedonthemonolithicmicrocomputer,proposedthearrayexpressionmethodforthestandardsetofthesourceprogramsentence.Thegoalcodesethasbeendefined.Establishingtherelationsbetweenthesourceprogramsentencestandardsetandthegoalcodesetwithsigmathemappinghasbeenproposed,sothattheconditionandthemethodforrealizationofthecompilestructurehasbeenprovided.Athoughtofthefillingblindcodeinadvanceandtherevisingblindcodehasbeenproposed。

AmentalityofcheckingmistakentothesourceprogramaccordingtotheMarrayhasbeenproposed.TheprocessingofthecheckingmistakentothesourceprogramhasbeenrealizedthroughaseriesofproceduresuchastheestablishmentoflistfilenameandlistdocumenLtherecognitiontoentiresentence.thesearchbylineusingMarrayinsentencegrammarinspection,thecheckuptokeywordwhetherequal,thecheckuptosentencelengthwhethercorrectandsoon.Theprocessofassemblingthefixedcodeintothegoaldocumentduringthetranslationhasbeenelaborated.Overallmentalityandtheprocedureofthetranslationandtheassemblycodehavebeenelaborated.Thepre-localizationofthesigmamappingbycarryingonthetyperecognitiontosourceprogramsentencedependonthearrayMhasinitiallybeenrealized.Thecharactertransformationfunctionforquotationname(bitaddress)hasbeendefinedeffectively,efirstkindofprocedurestructureandthesecondkindofprocedurestructureforrealizationsigmamappinghasseparatelybeengiven,sothatthetranslationofthesimpleactivecodeandthecomplexactivecodehaseffectivebeencompleted,andthattheassemblyofthegoaldocumenthasbeencompleted.Theprocedurerealizationmethodforthefirstkindofblindcoderevisionandthesecondkindofblindcoderevisionhasbeenproposedandelaborated.TheexperimentalsystemwhichusingtheresearchofcompilerdesignforPLCbasedonmonolithicmicrocomputerhasbeenestablished.Wehadcarriedontheconfirmationandcomparetotheeachfunctionofthecompiler.AftertheseveraIproceduretrials。

indicatedthatthecompilercantranslatecorrectlythe

sourceprogramofPLCbasedonmonolithicmicrocomputerintothetargetprogramwhichisenabletobeexecutedbymonolithicmicrocomputerandtalliestherequestofladderdiagramlogiccontr01.Theexperimentalresultprovedthatthecompil

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 面试

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1