西门子LC结构化编程13693190688田工

上传人:t****d 文档编号:206082981 上传时间:2023-05-02 格式:PPT 页数:35 大小:671KB
收藏 版权申诉 举报 下载
西门子LC结构化编程13693190688田工_第1页
第1页 / 共35页
西门子LC结构化编程13693190688田工_第2页
第2页 / 共35页
西门子LC结构化编程13693190688田工_第3页
第3页 / 共35页
资源描述:

《西门子LC结构化编程13693190688田工》由会员分享,可在线阅读,更多相关《西门子LC结构化编程13693190688田工(35页珍藏版)》请在装配图网上搜索。

1、Date:2023/5/2File:SSP2_01C.1SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation结构化编程结构化编程操作系统操作系统OB1FCFBFCFBSFCSFB其它其它OBsDate:2023/5/2File:SSP2_01C.2SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation

2、IEC 1131 标准标准q第一部分第一部分:主要信息主要信息定义定义 PLC 的术语的术语 PLC 的主要功能特点的主要功能特点q第二部分第二部分:设备要求设备要求电气电气,机械和功能上的要求机械和功能上的要求制造商需提供的信息制造商需提供的信息符合标准的规则符合标准的规则(一致性一致性)第三部分第三部分:编程语言编程语言梯形图梯形图,功能方框图,语句表功能方框图,语句表,顺序功能图和结构化文本顺序功能图和结构化文本q第四部分第四部分:用户指南用户指南系统分析和描述系统分析和描述PLC的选择和应用的选择和应用安全和保护,安装和维护安全和保护,安装和维护q第五部分第五部分:通讯通讯模式,通讯块

3、,与模式,通讯块,与ISO协议的对应关系协议的对应关系Modul:IEC_T1D.Date:2023/5/2File:SSP2_01C.3SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationIEC1131 内容内容-第三部分第三部分q 编译为标准代码的规则编译为标准代码的规则q 软件模型软件模型,通讯模型通讯模型,编程模型编程模型q 可编程逻辑控制语言中的通用元件可编程逻辑控制语言中的通用元件数据类型和变量数据类型和变量功能和功能块功能和功能块程

4、序和任务程序和任务q 指令表指令表(IL)IL)(=(=语句表语句表(STL)STL)q 结构化文本结构化文本(ST)ST)(=(=结构化控制语言结构化控制语言(SCL)SCL)q 梯形图梯形图(LD)LD)(=LAD)(=LAD)q 功能方框图功能方框图(FBD)FBD)q 顺序功能图顺序功能图(SFC)(=S7-GRAPH)SFC)(=S7-GRAPH)q附加的语法规则和编程示例附加的语法规则和编程示例Modul:IEC_T1D.Date:2023/5/2File:SSP2_01C.4SIMATIC S7Siemens AG 2000.All rights reserved.Informa

5、tion and Training CenterKnowledge for AutomationSIMATIC 管理器下的项目结构管理器下的项目结构项目项目S7/M7 程序程序(未分配给硬件的未分配给硬件的)用用 S7 块组成的用户程序,块组成的用户程序,OBs,FBs,FCs,DBs,等等STL 用户程序源文件用户程序源文件S7-300 可编程的可编程的 CPUS7/M7 程序程序(分配给硬件的分配给硬件的)用户程序用户程序硬件站硬件站STL 源文件源文件Date:2023/5/2File:SSP2_01C.5SIMATIC S7Siemens AG 2000.All rights rese

6、rved.Information and Training CenterKnowledge for AutomationSTEP7的块的块Date:2023/5/2File:SSP2_01C.6SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation块的组成部分块的组成部分变量声明表变量声明表 代码部分代码部分Date:2023/5/2File:SSP2_01C.7SIMATIC S7Siemens AG 2000.All rights reserv

7、ed.Information and Training CenterKnowledge for Automation 块的首部块的首部(36(36字节字节)块体块体 变量声明部分变量声明部分 和和 程序部分程序部分 或或 数据数据压缩的接口描述压缩的接口描述块的结构块的结构Date:2023/5/2File:SSP2_01C.8SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation结构化编程结构化编程OB 1电机电机 1FC 1电机电机 2FC 1

8、电机电机 3FC 1Date:2023/5/2File:SSP2_01C.9SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation利用局部数据进行控制利用局部数据进行控制FC1(数学功能数学功能)OB1FC1Input1Input2Input3Output_AFC1Input1Input2Input3Output_AMW53369MW10QW12QW20MW26869MW16I0.5I0.5SUB_IIN1IN2()M5.1OADD_IIN1IN2

9、M5.0O#TEMP1#INPUT1#INPUT2#TEMP1#INPUT3#Output_A 0.02.04.06.08.0Input1Input2Input3Output_ATEMP1inininouttempintintintintintsample measure 1constantoffsetresultintermediateDate:2023/5/2File:SSP2_01C.10SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation

10、局部变量局部变量临时变量临时变量 当相关块执行完毕后被清除 临时存储在 L stack中 可在下列块中使用 OBs/FCs/FBs静态变量静态变量当相关块执行完毕后仍然 保留 永久存储在DBs中 只能在FBs中使用局部变量局部变量/数据数据(只在一个块中有效)全局变量全局变量/数据数据(在全部程序中有效)PII/PIQ I/O M/T/C DB areas符号地址符号地址绝对地址绝对地址访问方式访问方式Date:2023/5/2File:SSP2_01C.11SIMATIC S7Siemens AG 2000.All rights reserved.Information and Traini

11、ng CenterKnowledge for Automation临时变量临时变量Date:2023/5/2File:SSP2_01C.12SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation执行的程序执行的程序局部数据堆栈的大小局部数据堆栈的大小对于对于 S7-300:局部堆栈大小局部堆栈大小优先级优先级256 bytes127总容量总容量:1.5 Kbyte(CPU 313.316)启动程序启动程序(只执行一次只执行一次)循环扫描程序循环扫描

12、程序256 bytes256 bytes256 bytes1232时间中断时间中断日时钟中断日时钟中断延时处理中断延时处理中断循环处理中断循环处理中断循环扫描中的错误处理中断循环扫描中的错误处理中断256 bytes162826256 bytes事件驱动中断事件驱动中断硬件中断硬件中断启动过程中的错误处理中断启动过程中的错误处理中断Date:2023/5/2File:SSP2_01C.13SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation块所需

13、要的局部数据区的长度块所需要的局部数据区的长度rechtsDate:2023/5/2File:SSP2_01C.14SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation256 Bytes事件所占用的 L stack1OB1OB 11操作系统程序所占用的局部数据区的总长度程序所占用的局部数据区的总长度FC 2有临时变量OB1FC2FC133OB1FC144OB1FC166FC 3有临时变量OB1FC3FC155FC 1有临时变量2OB1FC127O

14、B17Date:2023/5/2File:SSP2_01C.15SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.11.1:使用临时变量使用临时变量替换为临时变量替换为临时变量QW6Date:2023/5/2File:SSP2_01C.16SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automat

15、ion示例:故障信息指示示例:故障信息指示DisturbanceLEDAcknowledgeReport MemoryEdge Mem.BitDisturb.InputAcknowl.Flash Freq.Disturb.InputDisplayRS&=1&QSRPReport MemoryReport Memory解决方案解决方案要求要求Date:2023/5/2File:SSP2_01C.17SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automatio

16、nDisturb_inputReport_ memoryAcknowledgeEdge_ mem_bitDisplayFlash_freqFC 20调用调用可以分配参数的块可以分配参数的块Ai1.2Rm40.0Ai1.3Fp m40.1Sm 40.0Am40.0Am10.3OAnm40.0Ai1.3=Q4.3不可以不可以分配参数的块分配参数的块形式参数形式参数M 40.0M 40.1I 1.3I 1.2Q 4.3M 10.3实际参数实际参数A#AcknowledgeR#Report memoryA#Disturb_inputFP#Edge_mem_bitS#Report_memoryA#Rep

17、ort_memoryA#Flash_freq OAN#Report_memoryA#Disturb_input=#Display 可以分配参数的块可以分配参数的块程序程序Date:2023/5/2File:SSP2_01C.18SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation定义形式参数定义形式参数使用方法使用方法图形显示图形显示只能读在块的左侧只能写在块的右侧 参数类型参数类型输入参数输出参数输入/输出 参数 定义定义inoutIn_out

18、可读/可写在块的左侧 形式参数形式参数FC 20 的变量声明表的变量声明表Date:2023/5/2File:SSP2_01C.19SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation编辑一个可分配参数的块编辑一个可分配参数的块对于无参数分配的块,此处可能是:绝对地址:I1.3 符号地址:“End_left”Date:2023/5/2File:SSP2_01C.20SIMATIC S7Siemens AG 2000.All rights rese

19、rved.Information and Training CenterKnowledge for AutomationDisturb_inputAcknowledgeFlash_freqEdge_mem_bitDisplayENOENFC20调用一个分配了参数的块调用一个分配了参数的块Network 3:First CallNetwork 4:Second CallM40.1“Position error”“End left”.“Acknow.button”M10.3M40.0“End right”Q4.1“Acknow.button”M10.3M40.2符号的绝对的寻址方式寻址方式符号符号

20、局部符号-形式参数符号表全局符号Disturb_inputAcknowledgeFlash_freqReport_memoryEdge_mem_bitDisplayENOENFC20M40.3Q5.4Report_memoryDate:2023/5/2File:SSP2_01C.21SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationLAD/FBDSTL在块调用时使用在块调用时使用ENEN/ENO/ENO参数参数CALLFC1 NOP 0例子?.

21、?FC 1ENENOFC 2ENENOFC 3ENENO=FC 1ENENO?.?无条件调用AI 0.1 JNB_001 CALLFC1 _001:A BR =Q 5.0FC 1ENENOI 0.1=Q 5.0条件调用Date:2023/5/2File:SSP2_01C.22SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationFC 20 的变量声明表的变量声明表练习练习1.21.2:生成一个分配了参数的生成一个分配了参数的FCFC块块无参数的块无

22、参数的块分配了参数的块分配了参数的块 FC 20AI1.2RM40.0AI1.3FP M40.1SM 40.0AM40.0AM10.3OAN M40.0AI1.3=Q5.3A#AcknowledgeR#Report_memoryA#Disturb.:2.1.Date:2023/5/2File:SSP2_01C.23SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.31.3:调用一个分配了参数的调用一个分配了参数的FCFC块块Dist

23、urb_inputReport_memoryAcknowledgeEdge_mem_bitDisplayFlash_freq第一次调用第一次调用FC20时时的参数分配的参数分配 M 40.0M 40.1I 1.3I 1.2Q 5.3M 10.3FC 20Disturb_inputReport_memoryAcknowledgeEdge_mem_bitDisplayFlash_freqM 40.2M 40.3I 1.4I 1.2Q 5.4M 10.3FC 20第二次调用第二次调用FC20时时的参数分配的参数分配Date:2023/5/2File:SSP2_01C.24SIMATIC S7Siem

24、ens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationFB块块 FB 2ENDisturb.inputAcknowledgeDisplayFlash freq.ENODB 2OB 1FB块的变量声明表块的变量声明表Date:2023/5/2File:SSP2_01C.25SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation用用F

25、B实现的故障信息显示实现的故障信息显示FB的声明表背景数据块Date:2023/5/2File:SSP2_01C.26SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation生成背景数据块生成背景数据块1.在在FB调用时生成背景数据块调用时生成背景数据块2.创建一个新的背景数据块创建一个新的背景数据块 Date:2023/5/2File:SSP2_01C.27SIMATIC S7Siemens AG 2000.All rights reserved.

26、Information and Training CenterKnowledge for Automation多重背景模型多重背景模型DB10普通背景模型普通背景模型 FB20OB 1Call FB20,DB10Disturb._Input:=Acknowledge:=Flash_Freq:=Display:=DB11FB20Call FB20,DB11Disturb._Input:=Acknowledge:=Flash_Freq:=Display:=DB12FB20Call FB20,DB12Disturb._Input:=Acknowledge:=Flash_Freq:=Display:=

27、多重背景模型多重背景模型 FB 100DB100Call FB100,DB100OB 1statDist_1FB20statDist_2FB20Parameters andstatic variablesof the 2nd.call of FB20Call Dist_2Disturb._Input:=Acknowledge:=Flash_Freq:=Display:=Parameters andstatic variablesof the 1st.call of FB20Call Dist_1Disturb._Input:=Acknowledge:=Flash_Freq:=Display:=

28、Date:2023/5/2File:SSP2_01C.28SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.4:编写一个编写一个FB块块FB 20 的变量声明表的变量声明表1.FB 20 中的部分程序中的部分程序A#AcknowledgeR#Report memoryA#Disturb.:2.Date:2023/5/2File:SSP2_01C.29SIMATIC S7Siemens AG 2000.All rights reser

29、ved.Information and Training CenterKnowledge for Automation练习练习1.5:调用调用FB并调试并调试Date:2023/5/2File:SSP2_01C.30SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation插入插入/删除块的参数可能遇到的问题删除块的参数可能遇到的问题SaveDate:2023/5/2File:SSP2_01C.31SIMATIC S7Siemens AG 2000.A

30、ll rights reserved.Information and Training CenterKnowledge for Automation调用被修改过的块时应做的更正调用被修改过的块时应做的更正当调用块被打开时当调用块被打开时:单击鼠标右键单击鼠标右键Date:2023/5/2File:SSP2_01C.32SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习1.6:多台设备的风扇监控功能A B C=1 S_ODT TIME ACK

31、N SIG&A B C R S Q =1FLT FC101 REPORTA B C ACKN TIME TVFLT SIG功能 符号Date:2023/5/2File:SSP2_01C.33SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习1.7:风扇监控功能的扩展 A B C=1 S_ODT TIME ACKN SIG&A B C R S Q =1FLT FC101 REPORTA B C ACKN TIME TVFLT SIG功能 符号

32、 ENAB&ENAB ENABDate:2023/5/2File:SSP2_01C.34SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.8:识别变量的类型识别变量的类型AbsoluteSymbolicTemporaryStaticParameterL#Number_1T#Max_valueT MW 40StatementL#Number_2L#Intermediate_resultL“Number_1”T#Number_2Glob

33、alLocalDate:2023/5/2File:SSP2_01C.35SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation总结总结:块的调用块的调用 CALL FC1 UC FC1 CC FC1STLLADFBDFC1ENENOFC1ENENOFC1 (CALL)FB无参数,无背景数据块 UC FB1 CC FB1CALL有参数 CALL FC2 Par1:.Par2:.Par3:.FC2ENENOPar3Par1Par2FC2ENENOPar1Par2Par3有参数,有背景数据块 CALL FB2,DB3 Par1:.Par2:.Par3:.FB2ENENOPar3Par1Par2DB3FB2ENENOPar3Par1Par2DB3无参数语言FCFC1

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!