s7-300400 系统、维护与编程综合课程a7111serv2_01c_dbs_第1页
s7-300400 系统、维护与编程综合课程a7111serv2_01c_dbs_第2页
s7-300400 系统、维护与编程综合课程a7111serv2_01c_dbs_第3页
s7-300400 系统、维护与编程综合课程a7111serv2_01c_dbs_第4页
s7-300400 系统、维护与编程综合课程a7111serv2_01c_dbs_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.1数据块中的数据存储SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.2目标学习了本章之后,你将 .懂得全局数据块的用途.熟悉基本和复杂数据类型.能够对带有单元变量的数据块.熟悉并能够应用编址数据块

2、变编辑、存储和下装到CPU 量SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.3数据存储区位存储器PIQ. .PII.I/O 区L 堆栈数据块DBzDByDBxSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.4数据块 (DB)所有块可以访问FB

3、1的背景DB背景数据DB5功能块FB1功能FC20全局数据DB20功能FC10OB1SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.5STEP 7数据类型概述基本数据 位数据类型 (BOOL, BYTE, WORD, DWORD, CHAR)类型 数学数据类型 (INT, DINT, REAL)(到32 位) 定时器类型 (S5TIME, TIME, DATE, TIME_OF_DAY)复杂数据 时间 (DATE_AN

4、D_TIME)类型 矩阵 (ARRAY)(长于32位) 结构 (STRUCT) 字符串 (STRING)用户定义数据类型(长于 32 位)数据类型 UDT (用户定义数据类型)STEP 7基本数据类型SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.6关键字长度 (位)该类型的常数举例BOOL BYTE WORD DWORD CHAR1816328True 或 False (1 或0)B#16#A9 W#16#12AF

5、DW#16#ADAC1EF5 w S5TIME16S5T#5s_200msINT DINT REAL163232123L#655391.2 或 34.5E-12TIME DATETIME_OF_DAY321632T#2D_1H_3M_45S_12MS D#1993-01-20 TOD#12:23:45.12SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.7建立新数据块SIMATIC S7Siemens AG 2003.

6、 All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.8输入、保存、下载和监视数据块Data ViewDeclaration View寻址数据单元8 位70数据字节 0数据字节 1数据字节 2数据字节 3DBB 0DBW 0DBD 0DBX 4.1DBD 8188DBW 8190DBB 8191数据字节 8191SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and

7、DrivesDate: File:2018/10/1DBs.9SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.10访问数据单元完全表示访问传统访问方法绝对寻址符号寻址OPNValuesADBX 0.0或ADB99.DBX0.0或AValues.StatusOPNDB 99LDBB 1或LDB99.DBB1或LValues.StatesOPNValues或TDB99.DBW2或T Values.Number TDBW 2

8、OPNDB 99LDBD 8或LDB99.DBD8或L Values.Weight2DB 99ValuesAdd.NameType0.0StatusBOOL1.0StatesBYTE2.0NumberINT4.0Weight1REAL8.0Weight2REALSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.11练习: 计数传送的零件 (FC 18, DB 18):ACTUAL-number of parts QW 6

9、SETPOINT-number of partsIW 2ACTUAL=SETPOINT Q 8.4传送带模型 - LED0815CPU 程序: DB 18, FC 18模拟器练习: 计数传送的零件(FC 18), 答案提示NW 1:Set counter to 0复位的条件DB_Parts.ACT_Number_of_parts0NW 2:Counting using memory word, ACTUAL number of parts计数的上升沿DB_Parts.ACT_Number_of_partsDB_Parts.ACT_Number_of_parts1NW 3:Display ACT

10、UAL number of parts on BCD digital display零件的实际值(DB_Parts.ACT_Number_of_parts)从整数到BCD转换-结果在 BCD 数字显示 ( QW 6)NW 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”

11、.ACT_Number_of_parts)和给定值(MW 200),比较的结果送到红色的LEDSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.12ADD_IENENOIN1OUTIN2MOVEENOUTINENOSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/

12、10/1DBs.13初始值、实际值、初始化、记忆Upload in PGInitialize data block带初始值的DB带实际值的DB带初始值(实际值) 的DBSTEP 7programWork memory带实际值的DBLoad memory带初始值(实际值) 的DBSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.14如果你想知道更多复杂数据类型SIMATIC S7Siemens AG 2003. All r

13、ights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.15关键字长度 (位)举例DATE_AND_TIME64DT#97-09-24-12:14:55.0STRING(最多254个字符的字符串)8 * (字符个数+2 )This is a stringSIEMENSARRAY(相同数据类型的元素组)用户定义Measured values : ARRAY1.20INTSTRUCT(不同数据类型的元素组)用户定义Motor: STRUCT Speed : INT Current: REALE

14、ND_STRUCTUDT(用户定义数据类型 = 基本或复杂数据类型组成的模板)用户定义UDT 作为块UDT作为array 元素STRUCTSpeed : INT Current: REALEND_STRUCTDrive: ARRAY1.4UDT1SIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.16矩阵举例Measuring_point带有名字“Measuring_point” 的矩阵 (相同数据类型的几个元素)程序编辑

15、器中的显示 (数据块 DB 2):10. Measuring_point, data type Real1. Measuring_point, data type Real2. Measuring_point, data type Real3. Measuring_point, data type RealSIMATIC S7Siemens AG 2003. All rights reserved.SITRAIN Training for Automation and DrivesDate: File:2018/10/1DBs.17结构举例Motor_data带有名字“Motor_data” 的结构(不同数据类型的几个元素)程序编辑器中的显示 (数据块 DB 1):Speed, data type IntegerRated_current, data type RealStarting_current, data type RealDirection,

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论