Home > Forum > IEC 61131 Programming (LogicLab) > New function block for Modbus TCP / RTU Gateway
- This topic has 7 replies, 3 participants and was last updated 5 years, 11 months ago da Sergio Bertana.
-
AuthorPost
-
December 9, 2014 at 11: 31 am #35689Sergio BertanaAdministrator Forum
Many times it happens to have to connect serial Modbus devices to SCADA programs using an ethernet network as a connection. Since the SCADA when the Ethernet port is selected as the communication medium, they automatically use the Modbus TCP protocol. At this point, to connect Modbus RTU or Ascii serial devices via ethernet you need to use a Modbus TCP / RTU Gateway, there are stand-alone products on the market, see those distributed by us in the range of Ethernet-Serial converters. But if I want to connect multiple devices to a Gateway on the RS485 network, the Gateway must manage the passage of the node address (Topic) Given the cost comparable to a commercial Gateway of ours CPU module SlimLine, we have implemented the function block ModbusTCPGateway (Manual extract). Place a simple program that allows you to use a Compact CPU module as a Modbus TCP to Modbus RTU Gateway (Print program, Source project).
December 15, 2014 at 7: 01 pm #38587MauroParticipantI need to install some software on the PC like virtual serial port or similar if yes.
This block is useful for testing and trying to read registers in modbus (I hope).December 16, 2014 at 7: 30 am #38588Sergio BertanaAdministrator ForumThe function block acts as a gateway between a Modbus connection over TCP / IP and a Modbus RTU connection. Therefore it is assumed that the Modbus master device is a SCADA, an operator terminal or other, opens a TCP / IP connection to the SlimLine which acts as a gateway and therefore does not need a virtual COM.
But I don't understand what you mean when you want to do tests, if you have to interface with it SlimLine with Modbus RTU devices you can directly use the ModbusMaster FB, use the search above and you will see that you find a lot of information. In this topic you will also find information on PC Modbus test programs.
December 17, 2014 at 12: 56 pm #38600MauroParticipantTo do some tests I meant to connect to the Modbus board of a Crouzet crouzet PLC and try to read the registers to understand how I should configure them in the master block.
December 18, 2014 at 8: 41 am #38601Sergio BertanaAdministrator ForumI continue with the answer to the question in this topic in which we discussed the connection with PLC Crouzet.
October 3, 2017 at 12: 38 pm #39978AuthorlessIdleI'm trying on one slimline MPS054A100 the example with the ModbusGateway to query and set a temperature and a set point from an ASCOM X3 thermoregulator. The values will be read from a siemens Tia Portal v14 HMI station via Modbus / TCP port 502 (I have created the connection, the diagnostics says that everything is ok, but the two variables with addresses 40001 and 40002 are not available). On the Ascom I set the communication as Mbus, speed 9600 and Addr.1. Sullo Slimline da http://ip/System/HwSetup.htm: Serial port “COM2”: 9600 DTR On: 0 DTR Off. I cannot understand how to proceed to access the two values of the Ascom. Can you kindly give me some advice?
October 4, 2017 at 6: 33 am #39979Sergio BertanaAdministrator ForumIt's been a while since the first post in the meantime a new target XTarget_12.0 has been released and some things have been improved, now the FB is available SysTCPServer to manage the TCP connection in server mode and the FB SysSerialPort to manage the serial port, I then resumed the old project by modifying it and I thought of doing it in FBD instead of in ladder here is the result. Here then download the source program.
But let's get to your question, meanwhile the program is a communication gateway, that is, it allows the passage of data from a TCP connection to a serial connection and in passing the FB ModbusTCPGateway performs the conversion from the Modbus TCP protocol to the Modbus RTU protocol and vice versa.
If you see the port listening on the TCP server it is the 1000 (The 502 port is the one managed by default by the SlimLine with the Modbus TCP), so you have to set the 1000 port in the TIA portal otherwise it will dialogue with the Modbus protocol of the SlimLine and intereoghi its internal registers and not those of the thermoregulator.
Regarding the address of variables 40001 and 40002 they are addresses of variables of the SlimLine but you must refer to the addresses of the thermoregulator variables.
May 17, 2018 at 6: 49 am #44107Sergio BertanaAdministrator ForumReleased a version of the FB that acts as a gateway between Modbus TCP and RTU, the FB ModbusTCPGateway_v1 replaces the previous one. Among its new features is the ability to manage multiple connections in TCP / IP. So it is possible to have multiple Modbus TCP connections which are all addressed to a single Modbus RTU connection, here isextract of the manual.
I enclose the project ModbusTCPGateway accepting up to 3 Modbus TCP connections on the 1000 port and converting them to Modbus RTU on COM0 port (Download).
-
AuthorPost
- You must be logged in to reply to this topic.