0% found this document useful (0 votes)
222 views13 pages

Modbus TCP Communication With Logix Controllers Presentation

The document discusses Modbus history, topologies, data tables and addressing, function codes, data packets, Modbus TCP add-on instructions, a demonstration, and troubleshooting tips. It provides details on the development and standards of Modbus and how it can be implemented in different communication methods and applications.

Uploaded by

Heber Conza
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)
222 views13 pages

Modbus TCP Communication With Logix Controllers Presentation

The document discusses Modbus history, topologies, data tables and addressing, function codes, data packets, Modbus TCP add-on instructions, a demonstration, and troubleshooting tips. It provides details on the development and standards of Modbus and how it can be implemented in different communication methods and applications.

Uploaded by

Heber Conza
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/ 13

Agenda

1 Modbus
History
2 Topologies

3 Data
Tables and
Addressing 4 Function
Codes

5 Data
Packet
6 Modbus
TCP Add on
Instructions 7 Demo

8 Troubleshooting
Tips and Tricks

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 1


Modbus History

• Modbus was developed by Modicon in 1979


• Modicon was purchased by Schneider Electric
• In 2004 Schneider Electric transferred Modbus rights to the
Modbus Organization
• Modbus.org

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 2


Modbus Topologies
• Modbus uses a Client/Server relationship between devices.
• One Modbus Client can communicate to one or more Server devices to read or write data.

Modbus RTU Modbus TCP


Serial communication – RS-485 Ethernet communication

Modbus
Modbus Modbus Server
Client Server
Modbus Ethernet Modbus
Client Network Server
Modbus Modbus Modbus
Server Server Server
PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 3
Modbus Data Tables and Addressing
Name Address Prefix Element Size Access
Discrete Inputs 0x 1-bit Read-only
Coils 1x 1-bit Read/Write
Input Registers 3x 16-bit Read-only
Holding Registers 4x 16-bit Read/Write
• All data tables can contain elements 1 to 65,536. Historically the data tables used to be 1-9,999
• Modbus addresses may be represented by 4-, 5-, or 6-digit numbers. The first number is the
address prefix and will indicate the Modbus data table.
• The Application Layer of the OSI model uses addresses 1 to 65,536
• The Transport Layer of the OSI model uses addresses 0 to 65,535
• Example: Modbus Address 40,301 is contained in the Holding Registers data table and has a
transport layer address of 300.

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 4


Modbus Function Codes
Function Code Description Address Range
01 Read Coils 000001-065536
02 Read Discrete Inputs 10001-165563
05 Write Single Coil 000001-065536
15 Write Multiple Coils 000001-065536
03 Read Holding Registers 400001-465536
04 Read Input Registers 300001-365536
06 Write a Single Holding Register 400001-465536
16 Write Multiple Holding Registers 400001-465536

Note: The Modbus TCP AOIs provided on the Sample Code Library support these 8 function codes.
Other function codes exist but are not supported by the AOIs.

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 5


Modbus Data Packet

Modbus RTU: Unit ID Function Code Data CRC

Modbus TCP: MBAP Station ID Function Code Data

• The Modbus data packet is very similar between RTU and TCP
• The Station ID in Modbus TCP is the same as the Unit ID in Modbus RTU. When configuring a
gateway device to convert Modbus TCP to Modbus RTU the Station ID will be configured with the
Station ID of the target end device.
• The Data block is dependent on the chosen function code. It will contain information such as
starting register, number of registers, and data values.

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 6


Modbus TCP Add-on-Instructions
Downloadable from the Sample Code Library:

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 7


Modbus TCP Add-on-Instructions

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 8


Modbus TCP Add-on-Instructions
raC_Opr_NetModbusTCPClient tags

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 9


Demonstration

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 10


Troubleshooting Tips and Tricks
What to do when you have configured the Modbus TCP Client AOI, and it is not working
• Review the Transaction’s Diagnostic tag

• If you have multiple transactions enabled, disable all but the first. Once you get the first one working, you can
enable the others one at a time.
• If you are reading or writing to multiple registers, decrease that number to only one element. Once you can
successfully read or write to one element, increase the count back to the desired number.
• If an element in the end device is divided between multiple registers be sure to read or write to all the
registers in the same transaction. For instance, if you have a 32-bit element split between two holding
registers, do not read or write to only one of those registers.
PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 11
Troubleshooting Tips and Tricks

• Try adding 1 or subtracting 1 to the Begin Address


• Try changing the StationID tag between 0, 1, and -1. Many Modbus TCP server devices do not
need StationID to be set, but some will require a default value of either 0, 1, or -1. If this value
should be different, then it should be called out in the end device’s user documentation.
• Use a simulation tool on your computer to simulate either a Modbus Client or Server. Then either
try to communicate to your Logix controller or your end device to isolate the issue.
• Use Wireshark to analyze the Modbus data packets.

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 12


www.rockwellautomation.com

PUBLIC • Copyright ©2021 Rockwell Automation, Inc. 13

You might also like