欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    《结构化编程》PPT课件.ppt

    • 资源ID:80447591       资源大小:578.50KB        全文页数:35页
    • 资源格式: PPT        下载积分:11.9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要11.9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    《结构化编程》PPT课件.ppt

    Date:2023/1/20File:SSP2_01C.1SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation结构化编程结构化编程操作系统操作系统OB1FCFBFCFBSFCSFB其它其它OBsDate:2023/1/20File:SSP2_01C.2SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationIEC 1131 标准标准q第一部分第一部分:主要信息主要信息定义定义 PLC 的术语的术语 PLC 的主要功能特点的主要功能特点q第二部分第二部分:设备要求设备要求电气电气,机械和功能上的要求机械和功能上的要求制造商需提供的信息制造商需提供的信息符合标准的规则符合标准的规则(一致性一致性)第三部分第三部分:编程语言编程语言梯形图梯形图,功能方框图,语句表功能方框图,语句表,顺序功能图和结构化文本顺序功能图和结构化文本q第四部分第四部分:用户指南用户指南系统分析和描述系统分析和描述PLC的选择和应用的选择和应用安全和保护,安装和维护安全和保护,安装和维护q第五部分第五部分:通讯通讯模式,通讯块,与模式,通讯块,与ISO协议的对应关系协议的对应关系Modul:IEC_T1D.Date:2023/1/20File:SSP2_01C.3SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationIEC1131 内容内容-第三部分第三部分q 编译为标准代码的规则编译为标准代码的规则q 软件模型软件模型,通讯模型通讯模型,编程模型编程模型q 可编程逻辑控制语言中的通用元件可编程逻辑控制语言中的通用元件数据类型和变量数据类型和变量功能和功能块功能和功能块程序和任务程序和任务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/1/20File:SSP2_01C.4SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationSIMATIC 管理器下的项目结构管理器下的项目结构项目项目S7/M7 程序程序(未分配给硬件的未分配给硬件的)用用 S7 块组成的用户程序,块组成的用户程序,OBs,FBs,FCs,DBs,等等STL 用户程序源文件用户程序源文件S7-300 可编程的可编程的 CPUS7/M7 程序程序(分配给硬件的分配给硬件的)用户程序用户程序硬件站硬件站STL 源文件源文件Date:2023/1/20File:SSP2_01C.5SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationSTEP7的块的块Date:2023/1/20File:SSP2_01C.6SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation块的组成部分块的组成部分变量声明表变量声明表 代码部分代码部分Date:2023/1/20File:SSP2_01C.7SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation 块的首部块的首部(36(36字节字节)块体块体 变量声明部分变量声明部分 和和 程序部分程序部分 或或 数据数据压缩的接口描述压缩的接口描述块的结构块的结构Date:2023/1/20File:SSP2_01C.8SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation结构化编程结构化编程OB 1电机电机 1FC 1电机电机 2FC 1电机电机 3FC 1Date:2023/1/20File:SSP2_01C.9SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation利用局部数据进行控制利用局部数据进行控制FC1(数学功能数学功能)OB1FC1Input1Input2Input3Output_AFC1Input1Input2Input3Output_AMW53369MW10QW12QW20MW26869MW16I0.5I0.5SUB_IIN1IN2()M5.1OADD_IIN1IN2M5.0O#TEMP1#INPUT1#INPUT2#TEMP1#INPUT3#Output_A 0.02.04.06.08.0Input1Input2Input3Output_ATEMP1inininouttempintintintintintsample measure 1constantoffsetresultintermediateDate:2023/1/20File:SSP2_01C.10SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation局部变量局部变量临时变量临时变量 当相关块执行完毕后被清除 临时存储在 L stack中 可在下列块中使用 OBs/FCs/FBs静态变量静态变量当相关块执行完毕后仍然 保留 永久存储在DBs中 只能在FBs中使用局部变量局部变量/数据数据(只在一个块中有效)全局变量全局变量/数据数据(在全部程序中有效)PII/PIQ I/O M/T/C DB areas符号地址符号地址绝对地址绝对地址访问方式访问方式Date:2023/1/20File:SSP2_01C.11SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation临时变量临时变量Date:2023/1/20File: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)启动程序启动程序(只执行一次只执行一次)循环扫描程序循环扫描程序256 bytes256 bytes256 bytes1232时间中断时间中断日时钟中断日时钟中断延时处理中断延时处理中断循环处理中断循环处理中断循环扫描中的错误处理中断循环扫描中的错误处理中断256 bytes162826256 bytes事件驱动中断事件驱动中断硬件中断硬件中断启动过程中的错误处理中断启动过程中的错误处理中断Date:2023/1/20File:SSP2_01C.13SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation块所需要的局部数据区的长度块所需要的局部数据区的长度rechtsDate:2023/1/20File: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有临时变量2OB1FC127OB17Date:2023/1/20File:SSP2_01C.15SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.11.1:使用临时变量使用临时变量替换为临时变量替换为临时变量QW6Date:2023/1/20File:SSP2_01C.16SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation示例:故障信息指示示例:故障信息指示DisturbanceLEDAcknowledgeReport MemoryEdge Mem.BitDisturb.InputAcknowl.Flash Freq.Disturb.InputDisplayRS&=1&QSRPReport MemoryReport Memory解决方案解决方案要求要求Date:2023/1/20File:SSP2_01C.17SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationDisturb_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#Report_memoryA#Flash_freq OAN#Report_memoryA#Disturb_input=#Display 可以分配参数的块可以分配参数的块程序程序Date:2023/1/20File:SSP2_01C.18SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation定义形式参数定义形式参数使用方法使用方法图形显示图形显示只能读在块的左侧只能写在块的右侧 参数类型参数类型输入参数输出参数输入/输出 参数 定义定义inoutIn_out可读/可写在块的左侧 形式参数形式参数FC 20 的变量声明表的变量声明表Date:2023/1/20File:SSP2_01C.19SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation编辑一个可分配参数的块编辑一个可分配参数的块对于无参数分配的块,此处可能是:绝对地址:I1.3 符号地址:“End_left”Date:2023/1/20File:SSP2_01C.20SIMATIC S7Siemens AG 2000.All rights reserved.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符号的绝对的寻址方式寻址方式符号符号局部符号-形式参数符号表全局符号Disturb_inputAcknowledgeFlash_freqReport_memoryEdge_mem_bitDisplayENOENFC20M40.3Q5.4Report_memoryDate:2023/1/20File:SSP2_01C.21SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationLAD/FBDSTL在块调用时使用在块调用时使用ENEN/ENO/ENO参数参数CALLFC1 NOP 0例子?.?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/1/20File:SSP2_01C.22SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationFC 20 的变量声明表的变量声明表练习练习1.21.2:生成一个分配了参数的生成一个分配了参数的FCFC块块无参数的块无参数的块分配了参数的块分配了参数的块 FC 20AI1.2RM40.0AI1.3FP M40.1SM 40.0AM40.0AM10.3OAN M40.0AI1.3=Q5.3A#AcknowledgeR#Report_memoryA#Disturb.:2.1.Date:2023/1/20File:SSP2_01C.23SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.31.3:调用一个分配了参数的调用一个分配了参数的FCFC块块Disturb_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/1/20File:SSP2_01C.24SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for AutomationFB块块 FB 2ENDisturb.inputAcknowledgeDisplayFlash freq.ENODB 2OB 1FB块的变量声明表块的变量声明表Date:2023/1/20File:SSP2_01C.25SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation用用FB实现的故障信息显示实现的故障信息显示FB的声明表背景数据块Date:2023/1/20File:SSP2_01C.26SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation生成背景数据块生成背景数据块1.在在FB调用时生成背景数据块调用时生成背景数据块2.创建一个新的背景数据块创建一个新的背景数据块 Date:2023/1/20File:SSP2_01C.27SIMATIC S7Siemens AG 2000.All rights reserved.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:=多重背景模型多重背景模型 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:=Date:2023/1/20File: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/1/20File:SSP2_01C.29SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习练习1.5:调用调用FB并调试并调试Date:2023/1/20File:SSP2_01C.30SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation插入插入/删除块的参数可能遇到的问题删除块的参数可能遇到的问题SaveDate:2023/1/20File:SSP2_01C.31SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation调用被修改过的块时应做的更正调用被修改过的块时应做的更正当调用块被打开时当调用块被打开时:单击鼠标右键单击鼠标右键Date:2023/1/20File:SSP2_01C.32SIMATIC S7Siemens AG 2000.All rights reserved.Information and Training CenterKnowledge for Automation练习1.6:多台设备的风扇监控功能A B C=1 S_ODT TIME ACKN SIG&A B C R S Q =1FLT FC101 REPORTA B C ACKN TIME TVFLT SIG功能 符号Date:2023/1/20File: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功能 符号 ENAB&ENAB ENABDate:2023/1/20File: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_2GlobalLocalDate:2023/1/20File: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

    注意事项

    本文(《结构化编程》PPT课件.ppt)为本站会员(wuy****n92)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

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

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开