Modbus TCP Communication With Logix Controllers Presentation
Modbus TCP Communication With Logix Controllers Presentation
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
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.
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.
• 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.
• 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