数据块中数据存储

上传人:大米 文档编号:569238645 上传时间:2024-07-28 格式:PPT 页数:16 大小:625KB
返回 下载 相关 举报
数据块中数据存储_第1页
第1页 / 共16页
数据块中数据存储_第2页
第2页 / 共16页
数据块中数据存储_第3页
第3页 / 共16页
数据块中数据存储_第4页
第4页 / 共16页
数据块中数据存储_第5页
第5页 / 共16页
点击查看更多>>
资源描述

《数据块中数据存储》由会员分享,可在线阅读,更多相关《数据块中数据存储(16页珍藏版)》请在金锄头文库上搜索。

1、Date: 2024/7/28File:DBs.1SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives数据块中数据存储Stillwatersrundeep.流静水深流静水深,人静心深人静心深Wherethereislife,thereishope。有生命必有希望。有生命必有希望Date: 2024/7/28File:DBs.2SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Autom

2、ation and Drives目标学习了本章之后,你将学习了本章之后,你将 .懂得全局数据块的用途.熟悉基本和复杂数据类型.能够对带有单元变量的数据块编辑、存储和下装到CPU.熟悉并能够应用编址数据块变量Date: 2024/7/28File:DBs.3SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives位存储器位存储器PIQPII数据存储区数据存储区数据块数据块DBxDByDBz.I/O 区区L 堆栈堆栈Date: 2024/7/28File:DBs.4SIMATI

3、C S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives数据块数据块 (DB)功能功能FC10功能功能FC20功能块功能块FB1OB1全局数据全局数据 DB20 所有块可以访问所有块可以访问背景数据背景数据 DB5 FB1的背景的背景DBDate: 2024/7/28File:DBs.5SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesSTEP 7数据类型概述

4、数据类型概述基本数据类型(到32 位)复杂数据类型(长于32位)用户定义数据类型(长于 32 位) 位数据类型位数据类型 (BOOL, BYTE, WORD, DWORD, CHAR) 数学数据类型数学数据类型 (INT, DINT, REAL) 定时器类型定时器类型 (S5TIME, TIME, DATE, TIME_OF_DAY) 时间时间 (DATE_AND_TIME) 矩阵矩阵 (ARRAY) 结构结构 (STRUCT) 字符串字符串 (STRING)数据类型数据类型 UDT (用户定义数据类型)Date: 2024/7/28File:DBs.6SIMATIC S7Siemens AG

5、 2003. All rights reserved.SITRAIN Training for Automation and DrivesSTEP 7基本数据类型基本数据类型BOOL1True 或 False (1 或0)BYTE8B#16#A9WORD16W#16#12AFDWORD32DW#16#ADAC1EF5CHAR8 w S5TIME16S5T#5s_200msINT16123DINT32L#65539REAL321.2 或 34.5E-12TIME32T#2D_1H_3M_45S_12MSDATE16D#1993-01-20TIME_OF_DAY32TOD#12:23:45.12关

6、键字关键字长度长度 (位位) 该类型的常数举例该类型的常数举例Date: 2024/7/28File:DBs.7SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives建立新数据块建立新数据块Date: 2024/7/28File:DBs.8SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives输入、保存、下载和监视数据块输入、保存、下载和监视数据块D

7、eclaration ViewData ViewDate: 2024/7/28File:DBs.9SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives寻址数据单元寻址数据单元078 位数据字节 0 DBB 0数据字节 1 DBW 0数据字节 8191DBD 8188DBW 8190DBB 8191数据字节 2 DBD 0数据字节 3 DBX 4.1Date: 2024/7/28File:DBs.10SIMATIC S7Siemens AG 2003. All right

8、s reserved.SITRAIN Training for Automation and Drives访问数据单元访问数据单元DB 99 Values传统访问方法完全表示访问或LDB99.DBB1或LValues.States或A DB99.DBX0.0或AValues.Status或TDB99.DBW2或T Values.Number或LDB99.DBD8或L Values.Weight2绝对寻址符号寻址OPNDB 99LDBB 11.0StatesBYTEOPNValuesADBX 0.00.0StatusBOOLOPNValuesTDBW 22.0NumberINT4.0 Weigh

9、t1REALOPNDB 99LDBD 88.0 Weight2REALAdd. NameTypeDate: 2024/7/28File:DBs.11SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives练习练习: 计数传送的零件计数传送的零件 (FC 18, DB 18):0 8 1 5QW 6ACTUAL-number of partsSETPOINT-number of partsIW 2Q 8.4模拟器模拟器CPU 程序程序: DB 18, FC 18传送带模型传送

10、带模型 - LED ACTUAL=SETPOINTDate: 2024/7/28File:DBs.12SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives练习练习: 计数传送的零件计数传送的零件(FC 18), 答案提示答案提示NW 2:Counting using memory word, ACTUAL number of partsNW 1:Set counter to 0MOVEENINOUTENO复位的条件0DB_Parts.ACT_Number_of_part

11、sNW 4:Readin SETPOINT number of parts and convert from BCD to Integer来自数码拨轮 ( IW 2)的值从 BCD 转换到整数- 把零件的给定值 (Integer)存储在 MW 200NW 5:ACTUAL-SETPOINT comparison, LED (red LED Q8.4)比较实际值 (“DB_Parts”.ACT_Number_of_parts)和给定值(MW 200),比较的结果送到红色的LEDNW 3:Display ACTUAL number of parts on BCD digital display零件

12、的实际值(DB_Parts.ACT_Number_of_parts)从整数到BCD转换-结果在 BCD 数字显示 ( QW 6)ADD_IENIN1IN2OUTENO计数事件的上升沿1DB_Parts.ACT_Number_of_partsDB_Parts.ACT_Number_of_partsDate: 2024/7/28File:DBs.13SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives复杂数据类型复杂数据类型关键字关键字长度长度 (位位) 举例举例DATE_

13、AND_TIME64DT#97-09-24-12:14:55.0STRING8 * (字符个数+2 ) This is a string(最多254个字符的字符串) SIEMENS ARRAY用户定义 Measured values : ARRAY1.20(相同数据类型的元素组) INT STRUCT 用户定义 Motor: STRUCT(不同数据类型的元素组) Speed : INTCurrent: REALEND_STRUCTUDTUDT 作为块 UDT作为array 元素(用户定义数据类型 =用户定义 基本或复杂数据类型 STRUCT Drive: ARRAY1.4组成的模板)Speed

14、 : INT UDT1 Current: REAL END_STRUCT Date: 2024/7/28File:DBs.14SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives矩阵举例矩阵举例程序编辑器中的显示程序编辑器中的显示 (数据块数据块 DB 2):Measuring_point1. Measuring_point, data type Real2. Measuring_point, data type Real3. Measuring_point, data

15、 type Real10. Measuring_point, data type Real带有名字“Measuring_point” 的矩阵(相同数据类型的几个元素) Date: 2024/7/28File:DBs.15SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives结构举例结构举例程序编辑器中的显示程序编辑器中的显示 (数据块数据块 DB 1):Motor_dataSpeed, data type IntegerRated_current, data type R

16、ealStarting_current, data type RealDirection, data type Bool带有名字“Motor_data” 的结构(不同数据类型的几个元素) Date: 2024/7/28File:DBs.16SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and Drives练习(选作): 数据块和数据格式 IB1 DB10. DBW2 DB11. DBW8 BIN BCD QW6 DB11. DBW10 BIN BCD QW6 IB2MW2 BCD BINMW4 IB3MW6 BCD BINMW8 I0.7=“0” : BEC : BE

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 建筑/环境 > 施工组织

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