与西门子PLC通讯的Labview库,还不错

上传者: arhunn | 上传时间: 2022-01-07 10:48:02 | 文件大小: 215KB | 文件类型: -
与西门子PLC通讯的Labview库,还不错。 以下是英文声明: Warning, the attached files are experimental VIs provided for educational purposes only. No warrantee is expressed or implied. You should test your code and completely understand the implications of writing to or reading from an operating PLC. PLCs are often used to control hazardous processes and/or equipment. Writing to or reading from a PLC in active control of equipment or process can result in the disruption of the PLC program or data areas, potentially causing economic loss, property damage, generation or release of hazardous substances and/or personal injury up to and including death. Test your software in a controlled environment and qualify it before using it on active equipment or processes. To my knowledge, Siemens has never released the details of the S7 protocol. Much of what is publicly available on S7 is based on observations of the protocol by others. There is an open source S7 data exchange package available at http://libnodave.sourceforge.net/ that documents many S7 features. These VIs were based upon the example posted at http://decibel.ni.com/content/docs/DOC-5467. They were modified by observing and mimicking a S7 data exchange between a protocol converter and a S7-300 series PLC. The observations were accomplished with the wireshark network protocol analyzer, available at http://www.wireshark.org/ and the Wireshark Plugin f黵 S7-Protokoll, available at http://sps-forum.de/showthread.php?p=202763. The Address Area parameter determines which PLC memory area is the target for the reads and writes. I have only tested reads and writes to the Data Block (DB) Area. Your application should read and write to separate read and write DBs dedicated for transfer only. By confining reads and writes to dedicated Data Blocks, the risk of unintended overwrites may be reduced. The data type: S7Com_Transport_Size.ctl is a ring variable that contains the parameter for the size or type of the transfer. I have only had success with the BYTE, INT and DINT transport sizes on an S7-300 series PLC. The other sizes remain in the ring variable for testing on other PLCs. I do not know if the bytes of a multiple-byte variable are read or written atomically. The example contains two top-level VIs: S7Com_Once.vi and S7Com_W+R_Loop.vi. S7Com_Once.vi performs one read or write per execution. It writes to the target PLC from an array of I32, it reads from the target PLC into an array of I32. The number of bytes written is proportional to the number of elements in the array to be written and the transport size parameter. S7Com_W+R_Loop.vi regularly writes to and reads from a pair of DBs in the target PLC. In order to use it, your Step7 PLC project should provide two Data Blocks, DB11 and DB12. See the screen capture image db11&12.PNG for their layout. After downloading the DBs to your PLC, monitor and change DB VAlues with a VAT. As can be seen in the VI, the transfer size is DWORD. Included are example VIs (S7Com_to_PLC(SubVI).vi and S7Com_from_PLC(SubVI).vi) to map variables between Labview and the S7 PLC DBs. In the example, they use the same cluster type definition (S7Com_PLC_Data.ctl) but that is not a requirement. When you change the mappings, you must calculate the size of the variables to be read from the PLC in order to use the correct Read Length parameter. The read length parameter is in transport size units. The write length parameter is taken from the size of the write data array, so if the write data array is larger than you anticipate, data may be overwritten. The hex byte and hex byte array type definitions were created to format the internal data structures to show hex values so that they could be easily compared to the wireshark packet dumps. These VIs have been minimally tested on a NI 9072 cRIO. This is not finished. Needed are better error checking, cleaner S7 Response decoding, and stress testing with malformed data.

文件下载

评论信息

  • weixin_41015913 :
    刚下载还未使用
    2018-05-09
  • autoctrl666 :
    费劲搞起来了,发现根本不适合项目上用,玩家自娱自乐而已; 还是花钱找的官方的方案,用WinTcpS7程序集;
    2018-05-09

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明