SIEMENS 数据块中的数据存储 SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C. Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.1 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 数据块中的数据存储
SIEMENS 数据存储区 位存储器 DBZ PIQ DBY P y DBX o区 堆栈 数据块 SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C2 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.2 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 位存储器 PIQ PII 数据存储区 数据块 DBx DBy DBz . . . I/O 区 L 堆栈
SIEMENS 数据块(DB) 所有块可以访问 OB1 功能 FC10 全局数据 DB20 功能 FC20 FB1的背景DB 功能块 背景数据 FB1 DB5 SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C3 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.3 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 数据块 (DB) 功能 FC10 功能 FC20 功能块 FB1 OB1 全局数据 DB20 所有块可以访问 背景数据 DB5 FB1的背景DB
SIEMENS STEP7数据类型概述 基本数据 位数据类型(BooL,BYTE,WoRD, DWORD,cHAR) 类型 (到32位 ·数学数据类型( NT DINT,REAL) 定时器类型S5TME,TME, DATE TIME OF_DAY) 复杂数据 ·时间( DATE AND TIME) 类型 矩阵( ARRAY) (长于32位) 结构( TRUCT ·字符串(TR|NG) 用户定义数据类型 (长于32位) 数据类型UDT(用户定义数据类型) SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C 4 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.4 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation STEP 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 (用户定义数据类型)
SIEMENS STEP7基本数据类型 关键字 长度(位) 该类型的常数举例 BOOL Tue或Fase(1或0) BYTE B#16#A9 WORD 16 V#16#12AF DWORD DWEE 6#ADAC1EF5 CHAR 8 S5TIME 16 S5T#5s 200ms INT 16 123 DINT 32 L#65539 REAL 32 12或345E-12 TIME 32 T#2D1H3M45512MS DATE 16 D#1993-01-20 TIME OF DAY 32 ToD#12:23:45.12 SIMATIC S7 Date 20212/24 nformation and Training Center SSP1 12C5 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.5 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation STEP 7基本数据类型 BOOL 1 True 或 False (1 或0) BYTE 8 B#16#A9 WORD 16 W#16#12AF DWORD 32 DW#16#ADAC1EF5 CHAR 8 ' w ' S5TIME 16 S5T#5s_200ms INT 16 123 DINT 32 L#65539 REAL 32 1.2 或 34.5E-12 TIME 32 T#2D_1H_3M_45S_12MS DATE 16 D#1993-01-20 TIME_OF_DAY 32 TOD#12:23:45.12 关键字 长度 (位) 该类型的常数举例
SIEMENS 复杂数据类型 关键字 长度(位 举例 DATE AND TIME 64 DT#97-09-24-12:14:55.0 STRING 8*(字符个数+2) This is a string (最多254个字符的字符串) SIEMEN ARRA 用户定义 测量值: ARRAY[1.20 (相同数据类型的元素组) STRUCT 用户定义 Motor: StRUct (不同数据类型的元素组) Speed: INT Current: REAL END STRUCT UDT UDT as block UDT as array element 用户定义数据类型= 用户定义 基本或复杂数据类型组成的 STRUCT Drive: ARRAY[1.4] 模板) Speed: INT IDT Current: REAL END STRUCT SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C6 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.6 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 复杂数据类型 关键字 长度 (位) 举例 DATE_AND_TIME 64 DT#97-09-24-12:14:55.0 STRING 8 * (字符个数+2 ) ´This is a string´ (最多254个字符的字符串) ´SIEMENS´ ARRAY 用户定义 测量值:ARRAY[1..20] (相同数据类型的元素组) INT STRUCT 用户定义 Motor: STRUCT (不同数据类型的元素组) Speed : INT Current: REAL END_STRUCT UDT UDT as block UDT as array element (用户定义数据类型= 用户定义 基本或复杂数据类型组成的 STRUCT Drive: ARRAY[1..4] 模板) Speed : INT UDT1 Current: REAL END_STRUCT
SIEMENS 结构举例 Motor data Operating Speed, data type Integer Rated Current, data type Real 带有名字“ Motor data"的结构 Startup Current, data type Real (不同数据类型的几个元素) Turning Direction, data type Bool 程序编辑器中的显示(数据块DB1) 口DB1-Po116 MyProgram 口区 Address Name Type Initial Value Comment 0.d STRUCT +OmOtor data STRUCT rated current REAL 0.0ooe+000 +6.0 REAL 0. 000000e+000 +10.0 max temperature REAL 0.0ooe+000 +14.turning_ direction BOOL FALSE 16.0 END _ STRUCT =16.0 END STRUCT SIMATIC S7 Date 20212/24 nformation and Training Center Fe: SSP1 12C7 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.7 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 结构举例 程序编辑器中的显示(数据块DB 1): Operating Speed, data type Integer Rated Current, data type Real Startup Current, data type Real Turning Direction, data type Bool 带有名字“Motor_data” 的结构 (不同数据类型的几个元素) Motor_data
SIEMENS 矩阵举例 Measuring_ point 1. Measuring_ point, data type Real 2. Measuring_point, data type Real 3. Measuring_ point, data type Real 带有名字“ Measuring_ point”的矩阵 (相同数据类型的几个元素) 10. Measuring_point, data type Real 程序编辑器中的显示(数据块DB2) D DB2--Pro1 16\My Program 口区 Address Name Type Initial Value Comment 0,0 & sTRUCT +0.measuring_point ARRAY[1.10 REAL 40.0 END_STRUCT SIMATIC S7 Date nformation and Training Center Fe: SSP1 12C8 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.8 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 矩阵举例 1. Measuring_point, data type Real 2. Measuring_point, data type Real 3. Measuring_point, data type Real 10. Measuring_point, data type Real 带有名字“Measuring_point” 的矩阵 (相同数据类型的几个元素) • • • 程序编辑器中的显示(数据块DB 2): Measuring_point
SIEMENS 建立新数据块 HxLAD/STLFBD:Programming Blocks View Options Help Entry New Data Block Component view Block. DB4 Name Project Storage path Programming toot DB Editor Po116 zC- courses(Pro1_16 岛Pa11 口DB1 DDB2/CData block 白回 My Program C Data block referencing a user-defined data type e Source Files C Data block referencing a function block ed Block Refere Object name 84 Data block Cancel Help SIMATIC S7 Date 20212/24 nformation and Training Center Fe: SSP1 12C 9 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.9 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 建立新数据块
SIEMENS 输入、保存、下载和监视数据块 HE LAD/STL/FBD -[DB4-- 16\My Program O File Edit Insert PLC Debug View Options Window Help 口回回回园幽同 AddressName Initial Value comment STRUCT +0.nUmber of parts 工NT +2.0 Filling time SSTIME S5T#3S +4.0 Filling level min REAL 0.0ooe+000 +8.0 Measuring point nt ARRAY[1.10] 4,0 REAL =48.0 END STRUCT Press F1 for help Offline Abs INS MOD SIMATIC S7 Date 20212/24 nformation and Training Center Fe: SSP1 12C 10 Know ledge for Automation
Date: 2021/2/24 File: SSP1_12C.10 SIMATIC S7 Siemens AG 2000. All rights reserved. Information and Training Center Know ledge for Automation 输入、保存、下载和监视数据块