西门子S7结构化编程培训材料

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

Date:2019/12/16File:SSP2_01C.1SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation结构化编程操作系统OB1FCFBFCFBSFCSFB其它OBsDate:2019/12/16File:SSP2_01C.2SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationIEC1131标准第一部分:主要信息定义PLC的术语PLC的主要功能特点第二部分:设备要求电气,机械和功能上的要求制造商需提供的信息符合标准的规则(一致性)第三部分:编程语言梯形图,功能方框图,语句表,顺序功能图和结构化文本第四部分:用户指南系统分析和描述PLC的选择和应用安全和保护,安装和维护第五部分:通讯模式,通讯块,与ISO协议的对应关系Modul:IEC_T1D.Date:2019/12/16File:SSP2_01C.3SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationIEC1131内容-第三部分编译为标准代码的规则软件模型,通讯模型,编程模型可编程逻辑控制语言中的通用元件数据类型和变量功能和功能块程序和任务指令表(IL)(=语句表(STL))结构化文本(ST)(=结构化控制语言(SCL))梯形图(LD)(=LAD)功能方框图(FBD)顺序功能图(SFC)(=S7-GRAPH)附加的语法规则和编程示例Modul:IEC_T1D.Date:2019/12/16File:SSP2_01C.4SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationSIMATIC管理器下的项目结构项目S7/M7程序(未分配给硬件的)用S7块组成的用户程序,OBs,FBs,FCs,DBs,等STL用户程序源文件S7-300可编程的CPUS7/M7程序(分配给硬件的)用户程序硬件站STL源文件Date:2019/12/16File:SSP2_01C.5SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationSTEP7的块Date:2019/12/16File:SSP2_01C.6SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation块的组成部分变量声明表代码部分Date:2019/12/16File:SSP2_01C.7SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation块的首部(36字节)块体变量声明部分和程序部分或数据压缩的接口描述块的结构Date:2019/12/16File:SSP2_01C.8SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation结构化编程OB1电机1FC1电机2FC1电机3FC1Date:2019/12/16File:SSP2_01C.9SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation利用局部数据进行控制FC1(数学功能)OB1FC1Input1Input2Input3Output_AFC1Input1Input2Input3Output_AMW53369MW10QW12QW20MW26869MW16I0.5I0.5SUB_IIN1IN2()M5.1OADD_IIN1IN2M5.0O#TEMP1#INPUT1#INPUT2#TEMP1#INPUT3#Output_A0.02.04.06.08.0Input1Input2Input3Output_ATEMP1inininouttempintintintintintsamplemeasure1constantoffsetresultintermediateDate:2019/12/16File:SSP2_01C.10SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation局部变量临时变量•当相关块执行完毕后被清除•临时存储在Lstack中•可在下列块中使用OBs/FCs/FBs静态变量•当相关块执行完毕后仍然保留•永久存储在DBs中•只能在FBs中使用局部变量/数据(只在一个块中有效)全局变量/数据(在全部程序中有效)•PII/PIQ•I/O•M/T/C•DBareas符号地址绝对地址访问方式Date:2019/12/16File:SSP2_01C.11SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation临时变量Date:2019/12/16File:SSP2_01C.12SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation执行的程序局部数据堆栈的大小对于S7-300:局部堆栈大小优先级256bytes127总容量:1.5Kbyte(CPU313..316)启动程序(只执行一次)循环扫描程序256bytes256bytes256bytes1232时间中断日时钟中断延时处理中断循环处理中断循环扫描中的错误处理中断256bytes162826256bytes事件驱动中断硬件中断启动过程中的错误处理中断Date:2019/12/16File:SSP2_01C.13SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation块所需要的局部数据区的长度rechtsDate:2019/12/16File:SSP2_01C.14SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation256Bytes事件所占用的Lstack1OB1OB11操作系统程序所占用的局部数据区的总长度FC2有临时变量OB1FC2FC133OB1FC144OB1FC166FC3有临时变量OB1FC3FC155FC1有临时变量2OB1FC127OB17Date:2019/12/16File:SSP2_01C.15SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation练习1.1:使用临时变量替换为临时变量QW6Date:2019/12/16File:SSP2_01C.16SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation示例:故障信息指示DisturbanceLEDAcknowledgeReportMemoryEdgeMem.BitDisturb.InputAcknowl.FlashFreq.Disturb.InputDisplayRS&==1&QSRPReportMemoryReportMemory解决方案要求Date:2019/12/16File:SSP2_01C.17SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationDisturb_inputReport_memoryAcknowledgeEdge_mem_bitDisplayFlash_freqFC20调用可以分配参数的块Ai1.2Rm40.0Ai1.3Fpm40.1Sm40.0Am40.0Am10.3OAnm40.0Ai1.3=Q4.3不可以分配参数的块形式参数M40.0M40.1I1.3I1.2Q4.3M10.3实际参数A#AcknowledgeR#ReportmemoryA#Disturb_inputFP#Edge_mem_bitS#Report_memoryA#Report_memoryA#Flash_freqOAN#Report_memoryA#Disturb_input=#Display可以分配参数的块程序Date:2019/12/16File:SSP2_01C.18SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation定义形式参数使用方法图形显示只能读在块的左侧只能写在块的右侧参数类型输入参数输出参数输入/输出参数定义inoutIn_out可读/可写在块的左侧形式参数FC20的变量声明表Date:2019/12/16File:SSP2_01C.19SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation编辑一个可分配参数的块对于无参数分配的块,此处可能是:•绝对地址:I1.3•符号地址:“End_left”Date:2019/12/16File:SSP2_01C.20SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationDisturb_inputAcknowledgeFlash_freqEdge_mem_bitDisplayENOENFC20调用一个分配了参数的块Network3:FirstCallNetwork4:SecondCallM40.1“Positionerror”“Endleft”....“Acknow.button”M10.3M40.0“Endright”Q4.1“Acknow.button”M10.3M40.2符号的绝对的寻址方式符号局部符号--形式参数符号表全局符号Disturb_inputAcknowledgeFlash_freqReport_memoryEdge_mem_bitDisplayENOENFC20M40.3Q5.4Report_memoryDate:2019/12/16File:SSP2_01C.21SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationLAD/FBDSTL在块调用时使用EN/ENO参数CALLFC1NOP0例子??.?F

1 / 35
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功