10 min read
Your Guide to Integrating Modbus TCP/IP Devices into PCS 7
By: Christopher McCaslin on Jan 23, 2025 12:48:31 PM
Today, most modern control systems consist of a variety of hardware and field devices using a range of communication protocols, which means multiple methods are needed to ensure seamless communication between the distributed control system (DCS) and these field devices.
In two recent blog posts we explored how to integrate PROFINET devices into PCS 7 and S7 PLCs into PCS 7, now we will focus on how to integrate Modbus TCP/IP devices into PCS 7 by communicating directly with the PLC via Modbus TCP/IP (which is just one of several integration options available). The content in this post will likely be most helpful for instances where you need the main DCS to communicate with equipment provided by an OEM such as a boiler, chiller, or air compressor.
BACKGROUND ON SIEMENS' MODBUS COMMUNICATION LIBRARIES
To start, it is important to know that there are two different Modbus/TCP communications libraries Siemens maintains. The Modbus TCP/IP library is a great option for working with standard Modbus TCP/IP-compatible devices while the Open Modbus/TCP library is a good choice if you are working with advanced, non-standard Modbus implementations. In this post, we will discuss using the Modbus TCP/IP library and will reference devices that use onboard ports rather than an in-rack communication processor (CP) card.
WHAT YOU NEED TO KNOW BEFORE CONFIGURING YOUR MODBUS TCP/Ip DEVICES
Two of the first things you need to identify include if you will use one of the onboard PROFINET ports or an in-rack CP-443 card, and if you have a redundant automation system (AS) or a simplex AS, as there are different configurations to implement depending on the system architecture. Our licensing scheme in this example allows for redundant Modbus TCP/IP connections on both the server and client, allowing us to communicate between redundant PCS 7 controllers and Modbus TCP/IP servers.
Additionally, before you can start integrating your Modbus TCP/IP devices with your PCS 7 system, be sure you have the following information readily available:
- Register ranges that you’re communicating with and if there is a register offset difference between the two controllers – for example, if the data registers of PCS 7 starts at 0 while the other controller starts at 1
- IP address of the partner devices.
- Assigned port(s) for the Modbus TCP/IP network (i.e. X5, X8, etc.)
- Byte order – what are the most and least significant bits for non-binary values?
- How you want to pack the data – If there is flexibility in how you can pack the data, we don’t typically communicate coils because each coil consumes the same processor overhead as a word. Therefore, we recommend packing bits into words instead of sending individual bits on the PCS 7 side.
Also, here is some information to consider regarding the maximum number of devices and jobs that are supported in PCS 7:
- Maximum number of simultaneous Modbus TCP/IP client connections on a PROFINET port: 118 connections
- Maximum number of jobs per Modbus TCP/IP connection: 8 jobs
- Maximum length of READ register jobs: 125 registers
- Maximum length of WRITE register jobs: 123 registers
- 1/16 Register = 1 bit = 1 Boolean
- 1 Register = 16 bits = 1 Integer
- 2 Registers = 32 bit = 1 Floating point (real)
EXAMPLE: USING THE MODBUS/TCP WIZARD TO INTEGRATE YOUR DEVICES WITH PCS 7
To get started, the Modbus/TCP wizard first needs to be installed separately from the standard PCS 7 install media. The Modbus/TCP wizard can be found on the Siemens site here.
Installed PCS7 software with the Modbus/TCP Wizard
Below, we take you through a detailed configuration example for a duplex (redundant) PROFINET TCP Modbus communication system. Note that our hardware example does not have a CP card on the controller so we will use the PROFINET form of the Modbus/TCP communication and licensing. We have chosen the X8 ports on each controller for redundant Modbus/TCP communication. Also, we are the Modbus client in this scenario so we can read/write to the Modbus server, which is a different PLC.
Our example PCS 7 hardware configuration with redundant controllers.
With our communication methods selected and redundancy decided, we can move on to the Wizard.
1. Initial screen
2. Product selection screen
We chose “SIMATIC Modbus/TCP PN Red” since we are using redundant Modbus/TCP via PROFINET. If you were using either simplex or a CP card, one of the other options should be chosen.
3. Create the parameter data block
4. Select the blocks folder of the project
5. Upload connections
Since we already have some Modbus/TCP connections created for this project, several connections are already visible. If you do not have connections created, you would continue with a new connection. We will review the connection on ID 6/7.
6. Select the Modbus general parameters
We are a Modbus client and we want to connect to the Modbus server at startup. Single write is left unchecked in this example.
7. Enter the properties of the communication partner
Our Modbus server (i.e. device A) is not redundant, but we do have redundant controllers, so we will select the first option, “S7 is redundant.” The “Used interface” is the 410-5H CPU X8 port as we discussed earlier. An ID number and connection name will need to be assigned. The remote IP and remote port are the IP address and port of the Modbus server and will be identical on both connections in our example.
8. Identify and define the Modbus addresses
Standard Modbus addressing ranges (Source: Schneider Electric)
In this example, we are only using registers to transfer data; any bits that need to be transferred are packed into a register. The maximum length of a Modbus read register is 125 and 123 for write register. We have designated Jobs 1, 2, 7, and 8 as read registers. We have designated jobs 3, 4, 5, and 6 as write registers.
Some Modbus servers/clients will have an offset of 1 between the register number and the actual data address location; the end device offset should be checked to see if the data addresses differ. The register range of 7000 is short for register 47,000, which is the arbitrary start range selected by the Modbus server PLC (in this case it was a specific range reserved for communication by the customer). CFC data collector is selected, and we will use the CFC to set up the Job_List and Modbus communication block later on.
9. Create your Modbus parameter DB
We created DB2.
10. Review your connections
The overview screen lets you see what connections will be made. Press “Next” to create your DB parameter block.
11. Review the compilation report
Once the data block is created, it will give a compilation report. The checkbox to license the Modbus block can be selected for licensing.
12. License the Modbus Block
The Modbus license block must first be downloaded from the Modbus/TCP library, then installed into the PCS 7 project. Download it to the controller. The license code will be written into the CPU0 (not the SEC card) when the controller is online.
13. Send the screenshot you receive, like the one below, to Siemens support to assign a registry key.
Once successfully licensed, you can move on to configure the Job_List and Modbus/TCP communication CFC blocks.
14. Configuring the Job_List and Modbus Blocks
The next step is to place the Job_List block and MB_PNHCL blocks down from the Modbus/TCP library and interconnect them. The Job data, start, length, and read/write information must be configured for each job and should match the registers assigned in the wizard.
Below are some additional resources that may be helpful when configuring Modbus/TCP communication to PCS 7:
- Simatic S7-300/S7-400: Wizard for creating connection data for Modbus/TCP communication (Modbus/TCP Wizard)
- How do you request the license for the Modbus/TCP blocks using the Service & Support app?
- How many devices can you connect to an S7-300/S7-400 using the Modbus/TCP protocol?
- Add-on blocks for Modbus/TCP communication
- SIMATIC Modbus/TCP redundant communication
COMMON ISSUES WHEN INTEGRATING MODBUS TCP/IP DEVICES INTO PCS 7
If you run into issues when configuring your Modbus TCP/IP communication with PCS 7, here are some troubleshooting tips based on what we commonly see:
- Reinitialize the block (see the SIMATIC Modbus/TCP redundant communication manual)
- Check that the Job_List is running through its jobs, or if it has an error status (note that the Job_List will run even if Modbus is not licensed)
- Review the error codes listed in the SIMATIC Modbus/TCP redundant communication manual
- Look at the status of the connections on the Modbus Comms block; the STATUS_0A and STATUS_0B IO on the MB_PNHCL block are our redundant connection statuses.
- See if any data is communicating between devices, even bad data, to identify if device registers are word swapped, byte swapped or offset.
- Check that Modbus is properly licensed and recognized via the LICENSED IO output of the Modbus Comms block.
NEED ADDITIONAL ASSISTANCE?
As a certified Siemens Solutions Partner, we are well-qualified to help you integrate the latest Modbus TCP/IP devices into your PCS 7 system. Contact us today to see how we can partner with you to develop customized solutions designed to optimize performance and efficiency.
Related Posts
How to Communicate Modbus Natively with ControlLogix
The Modbus protocol was originally published in 1979 by Modicon as a simple request-response...
Your Guide to Integrating PROFINET Devices into PCS 7
Since PROFINET is the native communication protocol for PCS 7, integrating a PROFINET-enabled...
How to Integrate S7 PLCs into a PCS 7 Architecture
Many modern engineering systems are comprised of control systems from various manufacturers,...