结构化编程.

上传人:我** 文档编号:116963390 上传时间:2019-11-17 格式:PPT 页数:35 大小:675KB
返回 下载 相关 举报
结构化编程._第1页
第1页 / 共35页
结构化编程._第2页
第2页 / 共35页
结构化编程._第3页
第3页 / 共35页
结构化编程._第4页
第4页 / 共35页
结构化编程._第5页
第5页 / 共35页
点击查看更多>>
资源描述

《结构化编程.》由会员分享,可在线阅读,更多相关《结构化编程.(35页珍藏版)》请在金锄头文库上搜索。

1、Date:* File:SSP2_01C.1 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 结构化编程 操作系统 OB1 FC FBFC FB SFC SFB 其它 OBs Date:* File:SSP2_01C.2 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation I

2、EC 1131 标准 q第一部分: 主要信息 定义 PLC 的术语 PLC 的主要功能特点 q第二部分: 设备要求 电气, 机械和功能上的要求 制造商需提供的信息 符合标准的规则 (一致性) 第三部分:编程语言 梯形图, 功能方框图,语句表, 顺序功能图和结构化文本 q第四部分: 用户指南 系统分析和描述 PLC的选择和应用 安全和保护,安装和维护 q第五部分: 通讯 模式,通讯块,与ISO协议的对应关系 Modul: IEC_T1D. Date:* File:SSP2_01C.3 SIMATIC S7 Siemens AG 2000. All rights reserved. Informa

3、tion and Training Center Knowledge for Automation IEC1131 内容 - 第三部分 q 编译为标准代码的规则 q 软件模型, 通讯模型, 编程模型 q 可编程逻辑控制语言中的通用元件 数据类型和变量 功能和功能块 程序和任务 q 指令表 (IL) (= 语句表 (STL) q 结构化文本 (ST)(= 结构化控制语言 (SCL) q 梯形图(LD)(= LAD) q 功能方框图(FBD) q 顺序功能图(SFC) (= S7-GRAPH) q附加的语法规则和编程示例 Modul: IEC_T1D. Date:* File:SSP2_01C.4

4、 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation SIMATIC 管理器下的项目结构 项目 S7/M7 程序(未分配给硬件的) 用 S7 块组成的用户程序, OBs, FBs, FCs, DBs, 等 STL 用户程序源文件 S7-300 可编程的 CPU S7/M7 程序(分配给硬件的) 用户程序 硬件站 STL 源文件 Date:* File:SSP2_01C.5 SIMATIC S7 Siemens AG 2000. All

5、rights reserved. Information and Training Center Knowledge for Automation STEP7的块 Date:* File:SSP2_01C.6 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 块的组成部分 变量声明表 代码部分 Date:* File:SSP2_01C.7 SIMATIC S7 Siemens AG 2000. All rights reserved.

6、 Information and Training Center Knowledge for Automation 块的首部 (36字节) 块体 变量声明部分 和 程序部分 或 数据 压缩的接口描述 块的结构 Date:* File:SSP2_01C.8 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 结构化编程 OB 1 电机 1 FC 1 电机 2 FC 1 电机 3 FC 1 Date:* File:SSP2_01C.9 SI

7、MATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 利用局部数据进行控制 FC1 (数学功能) OB1 FC1 Input1 Input2 Input3 Output_A FC1 Input1 Input2 Input3 Output_A MW5 3369 MW10 QW12 QW20 MW2 6869 MW16 I0.5 I0.5 SUB_I IN1 IN2 ( ) M5.1 O ADD_I IN1 IN2 M5.0 O#TEMP1 #I

8、NPUT1 #INPUT2 #TEMP1 #INPUT3 #Output_A 0.0 2.0 4.0 6.0 8.0 Input1 Input2 Input3 Output_A TEMP1 in in in out temp int int int int int sample measure 1 constant offset result intermediate Date:* File:SSP2_01C.10 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge

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

10、ning Center Knowledge for Automation 临时变量 Date:* File:SSP2_01C.12 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 执行的程序 局部数据堆栈的大小 对于 S7-300: 局部堆栈大小 优先级 256 bytes 1 27 总容量: 1.5 Kbyte (CPU 313316) 启动程序 (只执行一次) 循环扫描程序 256 bytes 256 bytes 256 byt

11、es12 3 2 时间中断 日时钟中断 延时处理中断 循环处理中断 循环扫描中的错误处理中断 256 bytes16 28 26 256 bytes 事件驱动中断 硬件中断 启动过程中的错误处理中断 Date:* File:SSP2_01C.13 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 块所需要的局部数据区的长度 rechts Date:* File:SSP2_01C.14 SIMATIC S7 Siemens AG 200

12、0. All rights reserved. Information and Training Center Knowledge for Automation 256 Bytes 事件 所占用的 L stack 1 OB1 OB 1 1 操作系统 程序所占用的局部数据区的总长度 FC 2 有临时 变量 OB1 FC2 FC1 3 3 OB1 FC1 4 4 OB1 FC1 6 6 FC 3 有临时 变量 OB1 FC3 FC1 5 5 FC 1 有临时 变量 2 OB1 FC1 2 7 OB1 7 Date:* File:SSP2_01C.15 SIMATIC S7 Siemens AG 2

13、000. All rights reserved. Information and Training Center Knowledge for Automation 练习1.1: 使用临时变量 替换为临时变量 QW6 Date:* File:SSP2_01C.16 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 示例:故障信息指示 Disturbance LED Acknowledge Report Memory Edge Mem.

14、 Bit Disturb. Input Acknowl. Flash Freq. Disturb. Input Display RS & = =1 & QS R P Report Memory Report Memory 解决方案 要求 Date:* File:SSP2_01C.17 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation Disturb_ input Report_ memory Acknowledge Edge_ mem

15、_bit Display Flash_freq FC 20 调用 可以分配参数的块 A i 1.2 R m 40.0 A i 1.3 Fp m 40.1 S m 40.0 A m 40.0 A m 10.3 O Anm 40.0 A i 1.3 = Q 4.3 不可以 分配参数的块 形式参数 M 40.0 M 40.1 I 1.3 I 1.2 Q 4.3 M 10.3 实际参数 A #Acknowledge R #Report memory A #Disturb_input FP #Edge_mem_bit S #Report_memory A #Report_memory A #Flash_

16、freq O AN #Report_memory A #Disturb_input = #Display 可以分配参数的块 程序 Date:* File:SSP2_01C.18 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 定义形式参数 使用方法图形显示 只能读在块的左侧 只能写在块的右侧 参数类型 输入参数 输出参数 输入/输出 参数 定义 in out In_out可读/可写在块的左侧 形式参数 FC 20 的变量声明表 Date:* File:SSP2_01C.19 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Knowledge for Automation 编辑一个可分配参数的块 对于无参数分配的块,此处可能是: 绝对地址: I1.3 符号地址:“

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号