




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
As I think a lot of people involved into the automation world know , Siemens always shown a kind of adversity to equip its products with not-native Siemens protocols. One of these, born on far 1979 but still common, is the Modbus protocol for networks TCP/IP. Anyway, available from few years, Siemens release its on licensed-library in order to use Modbus TCP communication into the PN type CPU (300, 400, 400H), into the CP (343, 443) or into the CPU-PN equipped ET200S. Recently I had the possibility to test this library developing an application (S7-317 2PN/DP) who needs to run as Modbus Master (Client) reading / writings data to some relay controller (Areva) in order to control an hydroelectric power plant. Then I though to wrote this tutorial as a memo for some future similar jobs. Wish itll be usefull you too.Into this article Ill explain hot to implement to modbus TCP Client (Master) functionality into a CPU S7-315 2PN/DP firmware 3.2. Here follow hardware and software needed coponents: Software S7 Open Modbus TCP CPU PN Single License cod.2XV9450-1MB02 v.1.3 (for details take a look at) Software di progettazione Simatic Step 7 v.5.5 service pack 3 CPU S7 315 2PN/DP cod 6ES7315-2EH14-0AB0 + MMC (512kb is enough) Install the Open Modbus TCP CPU PN Single License package. A new Windows menu item will be added into Simatic menu: SIMATIC MODBUS TCP WIZARD. More over the MODBUS_PN_CPU library library will get into your Simatic Step7 resources. Create then a new Simatic project (in this article I call it MbTCP), then add into hardware configuration the CPU and then you can add following FB and the DB (besides the normal needed OB, void unattended CPU stop such as OB80, OB82, OB86, OB121, OB122,.) o FB102 (MODBUSPN) (v.3.4) : this is the heart of Simatic Modbus library . Copy it from the MODBUS_PN_CPU library included in Simatico FB63 (TSEND): copy it from the Standard Library, Communication Blocks included in Simatico FB64 (TRCV):copy it from the Standard Library, Communication Blocks included in Simatico FB65 (TCON): ccopy it from the Standard Library, Communication Blocks included in Simatico FB103 (TCP_COMM): Copy it from the MODBUS_PN_CPU library included in Simatico FB104 (MOD_CLI): Copy it from the MODBUS_PN_CPU library included in Simatico FB105 (MOD_SERV) : Copy it from the MODBUS_PN_CPU library included in Simatico FC10 (EQ_STRING):Copy it from the Standard Library, IEC Function Blocks included in Simatico DB2 (MODBUS_PARAM) : Copy it from the MODBUS_PN_CPU library included in Simatico DB3 (License DB) : Copy it from the MODBUS_PN_CPU library included in Simatic After insert the bottom listed FB and DB, its necessary to specify the Modbus communication parameters such as IP address, TCP port, target registers for R/W,. You can choose 2 way to do it: o Manually: editing the DB2 (MODBUS_PARAM) contained valueo By the Simatic Wizard (I suggest this.easier) Start the Wizard added during the installation of S7 Open Modbus TCP CPU PN Then press Next Into the new open pop-up, set the project you want edit (MbTCP) and the Block directory path (as I show in following picture). Then press Next Into the new open pop-up the Wizard requests to locate the DB2 (MODBUS_PARAM), then click the change option. Then press Next Is time now to define the working mode fo the CPU: Client=Master or Server=Salve. In my sample I set it as Client by click the single write (function code 05/06) option. Then press Next NOTE: Into the pop up Modbus General Parameters, the 3 options means: o 1 Click it if need PLC run as server (Slave), Leave it blank if need to run as Client (Master)o 2 Click it to enable the Modbus writing functionality (reading functionality is always active in Client Mode)o 3 Click it to enable the CPU (in Server mode) auto connect to the Client (do not use it.the FB102 already provides this functionality by its parameters) Into the new open pop-up fill the underlined fields as shown. Then press Next Communication Partners pop up description: o 1 Connection ID (it represent the Simatic internal reference ID).This ID must be provide as Input parameters into the FB102 at the IDo 2 Connection Name (freely editable)o 3 Connection Type (Active=Client=Master, Passive=Server=Slave)o 4 IP Address of communication partner (or TCP/RTU converter if present). It has to be into the same networko 5- Siemens hardware type (CPU, ET200,) Set the communication TCP port (usually the 502). Then press Next Set the read and write targets as show below: NOTE: o 1 - Modbus data type: possible selection between: Coils, Input, Holding Register, Input Registero 2 - first resister to read /write. In case of value 0, it represent the offest. (in my sample I start from 17)o 3 - last register to read /writeo 4 - Target data DB. Into it, the first record correspond to the start Address, 17 in my sample Then press Next If another CPU/project need to be edit then click Configure another connection otherwise click Finish Insert into the S7 project the FB102 instance (onto OB1 or a OB1 called FC/FB) as following shown: The instance DB (namedModbusPN_DI) will create during the call instruction of FB102. Itll contain FB102s requested parameters as:o ID: word=connection ID . It has to be the value specified during wizard (pop up Communication Partners)o DB_PARAM:BLOCK_DB parameters DB (DB2 according to wizard)o RECV_TIME: TIME=max receiving time (time-out)o CONN_TIME: TIME=max establish connection time (time-out)o KEEP_ALIVE:TIME=not usedo ENQ_REQ: BOOL= read/write request (rising edge). Good habit is to manage this bit according to communication status (STATUS_MODBUS) and the DONE_NDR bit (prevoius job done)Parameter In/Out Type Description Value range IDINWORDConnection-ID, must be identical to the associated parameter in the local connection description 1 to 4095 yesDB_PARAMINBLOCK_DBNumber of the parameter DBRECV_TIMEINTIMEMonitoring Time: Wait for data from communication partnerShortest adjustable time is 20 msCONN_TIMEINTIMEMonitoring Time: Wait for establishing or termination of the connectionShortest adjustable time is 100 msKEEP_ALIVEINTIMENot usedENQ_REQINBOOLCP is Client: Initiate request at positive edgeCP is Server: Ready to receive at TRUE signalDISCONNECTINBOOLS7 is Client: TRUE: the connection will be terminated after reception of the responseS7 is Server: TRUE: the connection will be terminated when ENQ_ENR = FALSEREG_KEYINSTRING17Registration key to activate the licenseLICENSEDINBOOLLicense state of the function blockBlock is licensedBlock is not licensedTRUEFALSEBUSYOUTBOOLOperating state of the T-functions (TCON, TDISCON, TSEND or TRCV)Job processingNo job processing activeTRUEFALSECONN_ESTABILISHEDOUTBOOLConnection establishedConnection endTRUEFALSEDONE_NDR OUTBOOLCP is Client: TRUE: Active request finished without errorsCP is Server: TRUE: Request from the client was executed and answeredERROR OUTBOOLAn error has occurred (TRUE)No error has occurred (FALSE)TRUEFALSESTATUS_MODBUS OUTWORDError number for protocol errors when evaluating a Modbus telegram (if 0)STATUS_CONNOUTSTRING8Error number for connection errors during execution of the T-blocks (TCON, TSEND,TRCV, DISON),. (if 0)UNITIN/OUTBYTEUnit i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 甘肃摄影基础知识培训课件
- 农村居民宅基地住房拆迁补偿协议9篇
- 挖掘机施工协议书5篇
- 安全施工培训教学课件
- 福建私人水族工程方案(3篇)
- 东风工程实施方案(3篇)
- 电信工程预算方案(3篇)
- 贵港港平南港区河山作业区华伟码头提档升级工程环评报告
- 防洪治理工程方案(3篇)
- 地灾工程治理方案(3篇)
- 苏教版科学五年级上册全册教案(含反思)
- 餐饮服务与数字化运营 习题及答案 项目六
- 天津地铁设备管理制度范文
- 跨学科整合的小学数学教学设计
- 人教版(2024)七年级下册英语期末复习:完形填空 专题练习题(含答案)
- 《电池管理系统BMS》课件
- DB33 1121-2016 民用建筑电动汽车充电设施配置与设计规范
- DB35∕T 88-2022 伐区调查设计技术规程
- 购物中心楼层调整规划
- 化学前沿研究动态(课件)
- 人教版八年级语文上册《新闻写作》示范公开教学课件
评论
0/150
提交评论