资源预览内容
第1页 / 共19页
第2页 / 共19页
第3页 / 共19页
第4页 / 共19页
第5页 / 共19页
第6页 / 共19页
第7页 / 共19页
第8页 / 共19页
第9页 / 共19页
第10页 / 共19页
亲,该文档总共19页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
Date:* File:SSP1_12C.1SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation数据块中的数据存储Date:* File:SSP1_12C.2SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation位存储器PIQPII数据存储区数据块DBxDByDBz.I/O 区L 堆栈Date:* File:SSP1_12C.3SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation数据块 (DB)功能 FC10功能 FC20功能块 FB1OB1全局数据DB20所有块可以访问背景数据DB5 FB1的背景DBDate:* File:SSP1_12C.4SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for AutomationSTEP 7数据类型概述基本数据 类型 (到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:* File:SSP1_12C.5SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for AutomationSTEP 7基本数据类型BOOL1True 或 False (1 或0) BYTE8B#16#A9 WORD16W#16#12AF DWORD32DW#16#ADAC1EF5 CHAR8 w S5TIME16S5T#5s_200msINT16123 DINT32L#65539 REAL321.2 或 34.5E-12TIME32T#2D_1H_3M_45S_12MS DATE16D#1993-01-20 TIME_OF_DAY32TOD#12:23:45.12关键字长度 (位) 该类型的常数举例Date:* File:SSP1_12C.6SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation复杂数据类型关键字长度 (位) 举例DATE_AND_TIME64DT#97-09-24-12:14:55.0STRING8 * (字符个数+2 ) This is a string (最多254个字符的字符串) SIEMENS ARRAY用户定义 测量值: ARRAY120 (相同数据类型的元素组) INT STRUCT 用户定义 Motor: STRUCT (不同数据类型的元素组) Speed : INT Current: REAL END_STRUCTUDTUDT as block UDT as array element (用户定义数据类型 =用户定义 基本或复杂数据类型组成的 STRUCT Drive: ARRAY14 模板)Speed : INT UDT1 Current: REAL END_STRUCT Date:* File:SSP1_12C.7SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation结构举例程序编辑器中的显示 (数据块 DB 1):Operating Speed, data type IntegerRated Current, data type RealStartup Current, data type RealTurning Direction, data type Bool带有名字“Motor_data” 的结构 (不同数据类型的几个元素) Motor_dataDate:* File:SSP1_12C.8SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation矩阵举例1. Measuring_point, data type Real2. Measuring_point, data type Real3. Measuring_point, data type Real10. Measuring_point, data type Real带有名字“Measuring_point” 的矩阵 (相同数据类型的几个元素) 程序编辑器中的显示 (数据块 DB 2):Measuring_pointDate:* File:SSP1_12C.9SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation建立新数据块Date:* File:SSP1_12C.10SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation输入、保存、下载和监视数据块Date:* File:SSP1_12C.11SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation寻址数据单元078 位数据字节 0 DBB 0数据字节 1 DBW 0数据字节 8191DBD 8188DBW 8190DBB 8191数据字节 2 DBD 0 数据字节 3 DBX 4.1Date:* File:SSP1_12C.12SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation访问数据单元0 1 2 34 5 6 7 8 9DB 19 (符号名: Values)带有元素名字 “Start” 的 数据位 0.0或 A DB19.DBX0.0或A “Values”.Start或L DB19.DBW2或L “Values”.Number或L DB19.DBB5或L “Values”.Loop传统访问方法符号寻址完全表示访问1)OPN DB19 L DBW2NumberOPN DB19 A DBX 0.01)OPN DB19 L DBB5Loop绝对寻址Date:* File:SSP1_12C.13SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation打开数据块的合法性OB 1OPNDB 4 LDBW2DB 4TDBW 2DB 4FC 1DB 4CALL FC 1TDBW 4DB 5OPNDB 5 LDBB6DB 5LDBW 0TDBW 8CALL FC 2FC 2DB 5DB 6OPNDB 6LDBB6DB 2T DB2.DBB 0DB 2LDBW 4LDBW 10DB ?FB 1CALL FB1, DB1?!Date:* File:SSP1_12C.14SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation全局 DB (例如)UDT 块作为模板用户定义数据类型 (UDT)FlourMilkEggsYeastSugar配方 2FlourMilkEggsYeastSugar配方 3FlourMilkEggsYeastSugarFlourMilkEggsYeastSugar根据UDT建立的 DB配方 1FlourMilkEggsYeastSugar带有三个UDT 类型的元素Date:* File:SSP1_12C.15SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation输入UDT块Date:* File:SSP1_12C.16SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation根据数据类型建立数据块Date:* File:SSP1_12C.17SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation举例:UDT中矩阵声明查看数据查看Date:* File:SSP1_12C.18SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation练习12.1: 数据块和数据格式IB1DB10.DBW1DB11.DBW8 BINBCDQW6DB11.DBW9BINBCDQW6IB2MW1BCDBINMW3IB3MW5BCDBINMW7I0.7=“0” : BEC: BEDate:* File:SSP1_12C.19SIMATIC S7 Siemens AG 2000. All rights reserved.Information and Training Center Knowledge for Automation练习12.2:瓶装线编程- 数据存储满瓶 (MW102)空瓶 (MW 100)碎瓶 (MW 104)数据块 DB5变量: full变量: empty变量: broken
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号