0% found this document useful (0 votes)
138 views8 pages

Change To ModbusTCP Slave R102

The Logix Modbus TCP Server can be modified to support multiple concurrent client connections and to respond properly to unknown Modbus function codes. Originally, the server only supported one connection and did not respond at all to unknown codes. To allow multiple connections, an XIC instruction is added to track received data. To respond to unknown codes, instructions are added to return an error, flag the event, and log the unknown code value. These changes improve communication reliability and debugging.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views8 pages

Change To ModbusTCP Slave R102

The Logix Modbus TCP Server can be modified to support multiple concurrent client connections and to respond properly to unknown Modbus function codes. Originally, the server only supported one connection and did not respond at all to unknown codes. To allow multiple connections, an XIC instruction is added to track received data. To respond to unknown codes, instructions are added to return an error, flag the event, and log the unknown code value. These changes improve communication reliability and debugging.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Logix Modbus TCP Server

Concurrent Client
Connection Activation

(Logix is the Modbus


Server)
Logix Modbus TCP Server: Concurrent Client Connections
Original File Name from Sample Code ID 89798 : ModbusTCP_Slave_R102.ACD
Logix Modbus TCP Server
• The manual indicates that the maximum number of concurrent (at the same time) Modbus TCP Client
Connections supported is 1.
This is a big limit. Consider that one single client can open more than one connection for each server. In the
case of our customer, the client (SCADA Software for Tunnel) open one dedicate connection to Read Data and
another one concurrent Connection to Write Data, two connection at the same time for each Modbus Server.
In this case a Modbus Server must support two concurrent connection to communicate with a single Modbus
Client

However, if you take a look in the code, you can see that it is wrote to support multiple concurrent Client
connections

Ticket number 4006203105 24/05/2017. No feedback


Logix Modbus TCP Server: Concurrent Client Connections
With the original code If you try to open a second client connection it’s fail with error, because
strange data are reported to the second connection. The second connection receive a ‘mix’ of data
from the first and from the second connection, the client shutodown the second connection with
error

To activate the ability to support multiple concurrent (as the same time) client connections:
• In the Routine “Packet_Processing” – Rung 9
Add an XIC instruction with TAG “Data_Received”

Tested with a maximum of 5 concurrent client connections, seems works fine. The code seem wrote
to support uo to 10 connections
Our customer use it with two concurrent connections from the same Modbus Client
BEFORE USE IT, YOU MUST TEST AND CHECK THE PERFORMANCE ,
FOR EVERY APPLICATIONS
Logix Modbus TCP Server
Response at Unknow
Modbus Function Code

(Logix is the Modbus


Server)
Logix Modbus TCP Server: Response to Unknow Modbus function code
Original File Name from Sample Code ID 89798 : ModbusTCP_Slave_R102.ACD
Logix Modbus TCP Server
• If the Logix Modbus TCP Server receive an unknow/unsupported Modbus function code from a Modbus Client, it
does not respond with an exeception error.
Logix Modbus TCP Server does not respond at all, in some cases the Client wait for timeout time and then
shutdown the connection, in other retry to send the function code for 3 time. This is time consuming, slow down
the communication and could be very difficult to diagnose.

Proposed improvement
• Logix Modbus TCP Server respond with an exception error to the unknow/unsupported Modbus Function Code
• Logix Modbus TCP Server sets True an internal Bool Tag to indicate that an unknown/unsupported Function
Code has been received
• Logix Modbus TCP Server copy the unknow/unsupported Modbus Function Code to an internal Logix Tag for
debug
Logix Modbus TCP Server: Response to Unknow modbus function code

Wireshark Trace, original Program

192.168.1.202 Modbus TCP Client -> Send Modbus Function Code 22


192.168.1.30 Logix Modbus TCP Server -> It does not support FC 22 and it
does not respond at all
192.168.1.202 Modbus TCP Client -> 3 tentatives
Logix Modbus TCP Server: Response to Unknow modbus function code
Original File Name from Sample Code ID 89798 : ModbusTCP_Slave_R102.ACD

Proposed improvement
Routine: Packet_Processing
Rung: 2
1
1. Add an AFI instruction in front of the first MOV instruction
2. Create a BOOL Tag (Ex DEBUG_FunctionCode_UNKW) and add an
OTL instruction in parallel to the ADD instruction
3. Create a SINT Tag (ex DEBUG_FunctionCode_UNKW_Hex), set the
Style to Hex, add a MOV instruction in parrallel
Set the source to: Main_Read_Buffer[RW_Select].DATA[7]
Set the destintaion to: DEBUG_FunctionCode_UNKW_Hex

2
3
Logix Modbus TCP Server: Response to Unknow modbus function code
Original File Name from Sample Code ID 89798 : ModbusTCP_Slave_R102.ACD
Wireshark Trace, after the proposed improvement

192.168.1.202 Modbus TCP Client -> Send Modbus Function Code 22


192.168.1.30 Logix Modbus TCP Server -> It does not support FC 22 and it
respond with error: Exception: Illegal Function

And in the Ladder code:


- DEBUG_FunctionCode_UNKW is True
- the value of DEBUG_FunctionCode_UNKW_Hex is equal to 16 Hex, that is the
unknow/unsupported Modbus Function Code received (16 Hex = 22 Dec)

You might also like