S7-300和S7-400集成PN口的S7通信

上传人:简****9 文档编号:112236443 上传时间:2019-11-05 格式:PDF 页数:13 大小:590.71KB
返回 下载 相关 举报
S7-300和S7-400集成PN口的S7通信_第1页
第1页 / 共13页
S7-300和S7-400集成PN口的S7通信_第2页
第2页 / 共13页
S7-300和S7-400集成PN口的S7通信_第3页
第3页 / 共13页
S7-300和S7-400集成PN口的S7通信_第4页
第4页 / 共13页
S7-300和S7-400集成PN口的S7通信_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《S7-300和S7-400集成PN口的S7通信》由会员分享,可在线阅读,更多相关《S7-300和S7-400集成PN口的S7通信(13页珍藏版)》请在金锄头文库上搜索。

1、S7-300S7-300 和和 S7-400S7-400 集成集成 PNPN 口的口的 S7S7 通信通信 1. S7 通信简介1. S7 通信简介 S7 通信是 S7 系列 PLC 基于 MPI、PROFIBUS、ETHERNET 网络的一种优化的通信协议,主 要用于 S7300/400PLC 之间的通信。SIMATIC S7- PN CPU 包含一个集成的 PROFINET 接 口,该接口除了具有 PROFINET I/O 功能,还可以进行基于以太网的 S7 通信。SIMATIC S7- PN CPU 支持无确认数据交换、确认数据交换和单边访问功能。功能块的调用如图 1、图 2 所 示。

2、块 S7-400 块 S7-300 描述简要描述 SFB 8FB 8用于发送 无确认的快速数据交换,发送数据后无对方接收确认。 SFB 9FB 9用于接收 SFB 12 FB 12用于发送 确认数据交换,发送数据后有对方接收确认。 SFB 13 FB 13用于接收 SFB 14 FB 14读数据单边编程读访问。 SFB 15 FB 15写数据单边编程写访问。 表 1 图 1 FAQ S7-300 和 S7-400 集成 PN 口的 S7 通信 This document constitutes a free excerpt compiled by the user himself/hersel

3、f from the documentation provided by Siemens for this product. Siemens disclaims all liability for the completeness of this document. It shall only be used for the users own internal purposes. It shall not be passed on to third parties. The complete documentation can be found at: /dokumentation/defa

4、ult.aspx?UserTopicGuid=a90a6850-2753-444d-a340-f4218e77e070&Language=zh-CHS2016/3/17 图 2 要通过 S7-PN CPU 的 集成 PROFINET 接口实现 S7 通信,需要在硬件组态中建立连接。 2. 硬件及网络组态2. 硬件及网络组态 CPU 采用两个 315-2PN/DP,使用以太网进行通信。 在 STEP7 中创建一个新项目,项目名称为 PN S7。插入两个 S7-300 站,在硬件组态中,分别 插入 CPU 315-2 PN/DP。如图 3 所示。 图 3 FAQ S7-300 和 S7-400 集

5、成 PN 口的 S7 通信 This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all liability for the completeness of this document. It shall only be used for the users own internal purposes. It shall not be p

6、assed on to third parties. The complete documentation can be found at: /dokumentation/default.aspx?UserTopicGuid=a90a6850-2753-444d-a340-f4218e77e070&Language=zh-CHS2016/3/17 新建以太网,打开“NetPro“设置网络参数,选中 CPU,在连接列表中建立新的连接。如图 4 所 示。 图 4 然后双击该连接,设置连接属性。在“General“属性中块参数 ID = 1,这个参数即是下面程序中 的参数“ID“。在 SIMATIC

7、 315PN-1 中激活“Establish an active connection“,作为 Client 端, SIMATIC 315PN-2 作为 Server 端。 3. 软件编程3. 软件编程 3.1. 无确认数据交换 SFB/FB 8 “USEND“ 向类型为“URCV“的远程伙伴 SFB/FB 发送数据。执行发送过程而不需要 和 SFB/FB 伙伴进行协调。也就是说,在进行数据传送时不需要伙伴 SFB/FB 进行确认。 S7-300:在 REQ 的上升沿处发送数据。在 REQ 的每个上升沿处传送参数 R_ID、 ID 和 SD_1。在每个作业结束之后,可以给 R_ID、ID 和

8、SD_1 参数分配新数值。 S7-400:在控制输入 REQ 的上升沿处发送数据。通过参数 SD_1 到 SD_4 来指向要 发送的数据,但并非都需要用到所有四个发送参数。 然而,必须确保参数 SD_1 到 SD_4/SD_1 和 RD_1 到 RD_4/RD_1 (在相应通讯伙 伴 SFB/FB “URCV“ 上)所定义的区域在以下几个方面保持一致: 编号 长度 数据类型 参数 R_ID 必须在两个 SFB 中完全相同。如果传送成功完成,则通过状态参数 DONE 来表示, 此时其逻辑数值为 1。 SFB/FB 9 “URCV“ 从类型为“USEND“的远程伙伴 SFB/FB 中异步接收数据,

9、并 把接收到的数据复制到组态的接收区域内。 当程序块准备好接收数据时,EN_R 输入处的逻辑值为 1。可以通过 EN_R=0 来取 消一个已激活的作业。 S7-300:在 EN_R 的每个上升沿处应用参数 R_ID、ID 和 RD_1。在每个作业结束 之后,可以给 R_ID、ID 和 RD_1 参数分配新数值。 S7-400:通过参数 RD_1 到 RD_4 来指向接收数据区。 必须确保参数 RD_i/RD_1 和 SD_i/SD_1 (在相应通讯伙伴 SFB/FB “USEND“ 上)所定义的区域在以下几个方面保持一致: 编号 长度 FAQ S7-300 和 S7-400 集成 PN 口的

10、S7 通信 This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all liability for the completeness of this document. It shall only be used for the users own internal purposes. It shall not be passed on

11、 to third parties. The complete documentation can be found at: /dokumentation/default.aspx?UserTopicGuid=a90a6850-2753-444d-a340-f4218e77e070&Language=zh-CHS2016/3/17 数据类型。 通过 NDR 状态参数逻辑数值为 1 来指示已经成功完成复制处理过程。参数 R_ID 必须在两个 SFB/FB 上完全相同。 打开 SIMATIC 315PN-1 的 OB1,在 OB1 中依次调用 FB8,FB9 如图 5、图 6 所示: 图 5 程序

12、中的参数说明见表 2 参数描述数据类型存储区描述 REQINPUTBOOL I、Q、M、D、L上升沿触发工作 IDINPUTWORDM、D、常数连接 ID R_IDINPUT DWORD I、Q、M、D、L、常数连接号,相同连接号的功能块互相 对应发送/接收数据 DONEOUTPUT BOOL I、Q、M、D、L为 1 时,发送完成 ERROROUTPUT BOOLI、Q、M、D、L为 1 时,有故障发生 STATUSOUTPUT WORDI、Q、M、D、L状态代码 S7-300: SD_1 S7-400: SD_i (1 i 4) IN_OUTANYM、D、T、Z I、Q、M、D、T、 C

13、发送数据区 表 2 FB8 参数说明 FAQ S7-300 和 S7-400 集成 PN 口的 S7 通信 This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all liability for the completeness of this document. It shall only be used for the users

14、own internal purposes. It shall not be passed on to third parties. The complete documentation can be found at: /dokumentation/default.aspx?UserTopicGuid=a90a6850-2753-444d-a340-f4218e77e070&Language=zh-CHS2016/3/17 图 6 程序中的参数说明见表 3 参数参数数据类型 存储区描述 EN_RINPUTBOOLI、Q、M、D、L、常数为 1 时,准备接收 IDINPUTWORDM、D、常数

15、连接 ID R_IDINPUTDWORD I、Q、M、D、L、常数连接号,相同连接号的功能块互相 对应发送/接收数据 NDROUTPUT BOOL I、Q、M、D、L为 1 时,接收完成 ERROROUTPUT BOOLI、Q、M、D、L为 1 时,有故障发生 STATUSOUTPUT WORDI、Q、M、D、L状态代码 S7-300: RD_1 S7-400: RD_i (1 i 4) IN_OUTANYM、D、T、Z I、Q、M、D、T、 Z 接收数据区 表 3 FB9 参数说明 同样,在 SIMATIC 315PN-2 的 OB1 中,调用 FB8/FB9。通信双方的“R_ID“均设为

16、0。将 SIMATIC 315PN-1 的 MB100-MB109 赋值 B#16#02,在 SIMATIC 315PN-2 中,将 FB9 的“EN_R“置 1,然后在 SIMATIC 315PN-1 中,将 FB8 中“REQ“设置上升沿信号,此时 SIMATIC 315PN-2 的 MB110-MB119 接收到 B#16#02。如图 7 所示。 FAQ S7-300 和 S7-400 集成 PN 口的 S7 通信 This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims all liability for the completeness of this document. It shall only be used for the user

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 管理学资料

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