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





《《结构化编程》PPT课件.ppt》由会员分享,可在线阅读,更多相关《《结构化编程》PPT课件.ppt(35页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、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 Automati
2、onIEC 1131 标准标准q第一部分第一部分:主要信息主要信息定义定义 PLC 的术语的术语 PLC 的主要功能特点的主要功能特点q第二部分第二部分:设备要求设备要求电气电气,机械和功能上的要求机械和功能上的要求制造商需提供的信息制造商需提供的信息符合标准的规则符合标准的规则(一致性一致性)第三部分第三部分:编程语言编程语言梯形图梯形图,功能方框图,语句表功能方框图,语句表,顺序功能图和结构化文本顺序功能图和结构化文本q第四部分第四部分:用户指南用户指南系统分析和描述系统分析和描述PLC的选择和应用的选择和应用安全和保护,安装和维护安全和保护,安装和维护q第五部分第五部分:通讯通讯模式,通
3、讯块,与模式,通讯块,与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 可编程逻辑控制语言中的通用元件可编程逻辑控制语言中的通用元件数据类型和变量数据类型和变量功能和功能块功能和功
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/1/20File:SSP2_01C.4SIMATIC S7Siemens AG 2000.All rights reserved.Inf
5、ormation 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
6、 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
7、 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电机
8、电机 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.1OAD
9、D_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
10、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
11、 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)启动程序启动程序(只执行一次只执行一
12、次)循环扫描程序循环扫描程序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
13、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有
14、临时变量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 CenterKnowl
15、edge 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 CenterKnowle
16、dge 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#R
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 结构化编程 结构 编程 PPT 课件

限制150内