您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 公司方案 > 12_数据块中的数据存储-西门子中文资料
Date:2020/2/17File:SSP1_12C.1SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation数据块中的数据存储Date:2020/2/17File:SSP1_12C.2SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation位存储器PIQPII数据存储区数据块DBxDByDBz...I/O区L堆栈Date:2020/2/17File:SSP1_12C.3SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation数据块(DB)功能FC10功能FC20功能块FB1OB1全局数据DB20所有块可以访问背景数据DB5FB1的背景DBDate:2020/2/17File:SSP1_12C.4SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationSTEP7数据类型概述基本数据类型(到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:2020/2/17File:SSP1_12C.5SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomationSTEP7基本数据类型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关键字长度(位)该类型的常数举例Date:2020/2/17File:SSP1_12C.6SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation复杂数据类型关键字长度(位)举例DATE_AND_TIME64DT#97-09-24-12:14:55.0STRING8*(字符个数+2)´Thisisastring´(最多254个字符的字符串)´SIEMENS´ARRAY用户定义测量值:ARRAY[1..20](相同数据类型的元素组)INTSTRUCT用户定义Motor:STRUCT(不同数据类型的元素组)Speed:INTCurrent:REALEND_STRUCTUDTUDTasblockUDTasarrayelement(用户定义数据类型=用户定义基本或复杂数据类型组成的STRUCTDrive:ARRAY[1..4]模板)Speed:INTUDT1Current:REALEND_STRUCTDate:2020/2/17File:SSP1_12C.7SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation结构举例程序编辑器中的显示(数据块DB1):OperatingSpeed,datatypeIntegerRatedCurrent,datatypeRealStartupCurrent,datatypeRealTurningDirection,datatypeBool带有名字“Motor_data”的结构(不同数据类型的几个元素)Motor_dataDate:2020/2/17File:SSP1_12C.8SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation矩阵举例1.Measuring_point,datatypeReal2.Measuring_point,datatypeReal3.Measuring_point,datatypeReal10.Measuring_point,datatypeReal带有名字“Measuring_point”的矩阵(相同数据类型的几个元素)•••程序编辑器中的显示(数据块DB2):Measuring_pointDate:2020/2/17File:SSP1_12C.9SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation建立新数据块Date:2020/2/17File:SSP1_12C.10SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation输入、保存、下载和监视数据块Date:2020/2/17File:SSP1_12C.11SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation寻址数据单元078位数据字节0DBB0数据字节1DBW0数据字节8191DBD8188DBW8190DBB8191数据字节2DBD0数据字节3DBX4.1Date:2020/2/17File:SSP1_12C.12SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation访问数据单元0123456789DB19(符号名:Values)带有元素名字“Start”的数据位0.0或ADB19.DBX0.0或A“Values”.Start或LDB19.DBW2或L“Values”.Number或LDB19.DBB5或L“Values”.Loop传统访问方法符号寻址完全表示访问1)OPNDB19LDBW2NumberOPNDB19ADBX0.01)OPNDB19LDBB5Loop绝对寻址Date:2020/2/17File:SSP1_12C.13SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation打开数据块的合法性OB1OPNDB4LDBW2DB4TDBW2DB4FC1DB4CALLFC1TDBW4DB5OPNDB5LDBB6DB5LDBW0TDBW8CALLFC2FC2DB5DB6OPNDB6LDBB6DB2TDB2.DBB0DB2LDBW4LDBW10DB??FB1CALLFB1,DB1???!Date:2020/2/17File:SSP1_12C.14SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation全局DB(例如)UDT块作为模板用户定义数据类型(UDT)FlourMilkEggsYeastSugar配方2FlourMilkEggsYeastSugar配方3FlourMilkEggsYeastSugarFlourMilkEggsYeastSugar根据UDT建立的DB配方1FlourMilkEggsYeastSugar带有三个UDT类型的元素Date:2020/2/17File:SSP1_12C.15SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation输入UDT块Date:2020/2/17File:SSP1_12C.16SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation根据数据类型建立数据块Date:2020/2/17File:SSP1_12C.17SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation举例:UDT中矩阵声明查看数据查看Date:2020/2/17File:SSP1_12C.18SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation练习12.1:数据块和数据格式IB1DB10.DBW1DB11.DBW8+=BINBCDQW6DB11.DBW9BINBCDQW6IB2MW1BCDBINMW3IB3MW5BCDBINMW7+=I0.7=“0”:BEC:BEDate:2020/2/17File:SSP1_12C.19SIMATICS7SiemensAG2000.Allrightsreserved.InformationandTrainingCenterKnowledgeforAutomation练习12.2:瓶装线编程-数据存储满瓶(MW102)空瓶(MW100)碎瓶(MW104)数据块DB5变量:full变量:empty变量:broken
本文标题:12_数据块中的数据存储-西门子中文资料
链接地址:https://www.777doc.com/doc-3835786 .html