How-to
Configure Modbus RTU on an S7-400H master over serial CPs
Short answer
An S7-400H cannot run Modbus RTU from the CPU, so fit one serial CP in each of the two subsystems, license the Modbus_Red redundant library, and poll the S7-1500's CM PtP as a separate slave link. Keep the existing PUT/GET path for the bulk PLC-to-PLC data and reserve RTU for the registers the client actually requires.
On this page
An S7-400H cannot generate Modbus RTU by itself: a CPU 414-5H has no serial port and no RTU stack, so you fit one serial communication processor in each of the two subsystems — two CPs — license the redundant serial library Modbus_Red, and poll the S7-1500's CM PtP as a separate slave link. Configure the two stations independently: Modbus_Comm_Load opens the S7-1500 side, the licensed library's client blocks drive the redundant master side, and the redundancy mechanism, not two independent masters, owns the bus across a switchover. Leave the PUT/GET path over PROFINET carrying the bulk PLC-to-PLC data, and put on RTU only the registers the client contract actually names.
Decide which link actually needs Modbus RTU #
You have two candidate links here and they are configured separately. The PUT/GET exchange over PROFINET already moves your input data; the client requirement is what forces RTU for part of it. Sort every value into one link or the other before you touch the hardware, because the CP count and the license follow from that decision.
| Link | Master | Slave | What you build |
|---|---|---|---|
| S7-400H reads data held in the S7-1500 | The redundant master's serial CP | S7-1500 CM PtP | One serial CP per subsystem, Modbus_Red licensed, register map agreed |
| S7-1500 collects third-party device data | S7-1500 CM PtP | Third-party device or simulator | One port opened with Modbus_Comm_Load, requests to the remote map |
Keep the bulk exchange on PUT/GET and add a rolling counter to the transfer so the receiver can reject a repeated or stale block. The S7-1500 can hold both roles — slave to the redundant master and master to the third party — but those are two physical links, because one RTU port carries one link and takes one role; a single-port CM PtP cannot do both. If the third-party side grows past one device, the same one-master rule holds and a polling scheduler decides who is asked and when, as set out in how to poll many Modbus RTU slaves from one serial master.
Fit two serial CPs and license the redundant library #
The CPU designation tells you nothing about the serial hardware: inventory both subsystems before ordering anything. The redundant arrangement needs one serial CP per subsystem, because a single CP serves only the subsystem it sits in and a switchover would orphan the link. The redundant serial library Modbus_Red is licensed, and keys generated for redundant H systems are tied to the specific CPU serial number or memory card — replace a CPU and you request a new key before that subsystem's link runs again. Before you order, confirm the CPU, CP and library combination is released in the vendor's documentation; the released lists exist because not every CP pairs with every library version.
If the client accepts Modbus TCP instead of RTU, the documented redundant path avoids serial hardware altogether: a CP 443-1 in each redundant rack plus the redundant license, with the MB_RED_CLIENT and MB_RED_SERVER instructions carrying the exchange. Settle that with the client first, because it changes the hardware order.
Set up the S7-1500 as the RTU slave #
The CM PtP you already fitted provides the port. Call Modbus_Comm_Load once at start-up to open it — port, framing and the Modbus RTU mode all go into that call — and check its status before anything else runs. The matching slave instruction then publishes the holding-register map from a data block, and that map is what the redundant master reads; agree the addresses with the client and document them.
One port, one role: if this CM PtP answers the redundant master, the third-party master link needs another port or a second module. When the block sits idle after the call — 16#7000 is the classic case on an S7-1500 CM PtP — the initialization never progressed, which we worked through in Modbus_Comm_Load on an S7-1500 CM PtP stays idle at 16#7000.
Configure and test the link step by step #
- Inventory the hardware. List the serial CP in each subsystem of the redundant master and the CM PtP in the S7-1500, with order numbers, and confirm the released combination against the vendor documentation. Expected result: a documented hardware list before any purchase order.
- License the library. Install the Modbus_Red keys in both subsystems and file each key record against the CPU it was generated for. Expected result: the library loads without a license fault on both masters.
- Set identical framing. In the hardware configuration of STEP 7, set baud rate, parity, data bits and stop bits identically at both ends of the link, and assign the slave address. Expected result: both stations read the same port settings.
- Wire the bus. For a multi-drop link use the two-wire connection the CP manual specifies for that port, with the line termination and biasing it calls for at the segment ends; for the bench test, follow the module's pin diagram. Expected result: signals identified, terminated and common-referenced per the manual.
- Initialize before the first request. Call Modbus_Comm_Load once on the S7-1500 and the library's initialization block once in each subsystem of the redundant master, and gate the first read on the Done status. Expected result: initialization completes, not an idle status, before the first request goes out.
- Run one transaction at a time. Program each client instance to finish a request-answer cycle before it issues the next, because a serial link carries exactly one outstanding request per instance. Expected result: no overlapping jobs on one link.
- Read one register you set yourself. Write a known value into one slave register on the simulator or the S7-1500's map, read it from the 400H, and check the value and the data interpretation, not just a Done flag. Expected result: the value you wrote appears unchanged in the master's receive buffer.
- Force the switchover. Trigger an H changeover while a request is outstanding. Expected result: the library hands bus ownership to the other subsystem and the next request completes.
Keep the link's communication-valid status separate from the last received value in your program, so a frozen register left behind by a failed poll or a switchover cannot drive a control decision as if it were live data.
Worked example: polling four holding registers from the S7-1500 at 9600 baud 8E1 #
Inputs, with their sources:
- Function 03, read holding registers; slave address 3; four registers, protocol addresses 0 through 3. Example inputs for this case — the installed values come from the client's register map.
- 9600 bit/s, 8 data bits, even parity, 1 stop bit (8E1), the port settings from step 3. With parity, every RTU character is 11 bits on the wire: start, 8 data, parity, stop.
- 10 ms slave turnaround, an assumption for this example; measure the installed CM PtP's real answer time in step 7 and substitute it.
Rule, from the Modbus RTU serial framing: every frame closes with a 16-bit CRC and the bus falls silent for 3.5 character times between frames. Cycle time = total frame bytes × 11 bits ÷ baud rate + 2 × 3.5-character silences + slave turnaround.
Arithmetic:
- Request frame: address + function + start address + quantity + CRC-16 = 1 + 1 + 2 + 2 + 2 = 8 bytes.
- Response frame: address + function + byte count + 4 registers × 2 bytes + CRC-16 = 1 + 1 + 1 + 8 + 2 = 13 bytes.
- Wire time: 21 bytes × 11 bits = 231 bits; 231 ÷ 9600 bit/s = 24.1 ms.
- Silence: 2 × 3.5 × 11 bits = 77 bits; 77 ÷ 9600 bit/s = 8.0 ms.
- Cycle: 24.1 + 8.0 + 10 = 42.1 ms, call it 42 ms.
Result: one request-answer cycle for these four registers costs about 42 ms on that port.
Decision: polled every 250 ms, the link runs at 42 ÷ 250 ≈ 17 percent wire load, leaving room for the rest of the map — each extra register adds 22 bits (2 bytes × 11 bits), about 2.3 ms, to every cycle. If the client requires these four registers every 100 ms, that cycle already takes 42 percent of the wire and leaves no headroom as the map grows: move the port to 19200 bit/s, where the frames take 16.0 ms and the cycle about 26 ms including turnaround. This per-cycle budget is the same arithmetic behind why Modbus RTU polling on one serial port is slow.
The decision for each link #
- Bulk PLC-to-PLC data: stays on PUT/GET over PROFINET with a rolling counter in the transfer. Rebuilding it as RTU buys nothing and costs two licensed serial CPs.
- Client-required RTU from the redundant master: one serial CP in each subsystem, Modbus_Red licensed against both CPU serial numbers or memory cards, and the S7-1500's CM PtP answering as the slave, with the redundancy mechanism owning the bus — never two independent masters.
- Third-party collection: the S7-1500 as master on its own port. Fix the failed simulator test by putting the simulator on a physical serial link, matching the framing from step 3, and reading one register you set yourself before scaling to the real map.
- Before go-live: measure the installed link's real turnaround, substitute it for the example's 10 ms, and re-run the cycle arithmetic against the poll interval the client demands.
Questions asked
Can one serial port on the S7-1500 serve the S7-400H and a third-party device at once?
No. One RTU port carries one link and takes one role, master or slave. Run the slave link to the S7-400H and the master link to the third-party device on separate serial interfaces: check how many ports the fitted CM PtP provides, and fit a second module if it has a single port. Two independent masters on one ordinary RTU bus is never a valid arrangement.
How do you confirm the Modbus license actually took on the CPU?
The license key for a redundant H system is generated against the CPU's serial number or its memory card, so keep the delivery record with the panel documentation; a replaced CPU needs a new key before the link runs again. The newer TIA instructions make verification visible: their LICENSED output reads TRUE once the key is accepted for that CPU. On the redundant serial library, follow the license delivery paperwork and the library's own status outputs.
What should you read first when a poll fails?
Read the failure type before changing anything. An initialization status that sits at its idle value — 16#7000 is the classic case on an S7-1500 CM PtP — means the port never opened, so check the module selection and port parameters first. A timeout points at wiring, framing or a wrong slave address. A genuine exception reply carries the requested function number plus 128 in the function byte and a separate exception code that names the rejection, so a valid-looking reply can still be a refusal.
Does an H switchover move the serial link automatically?
The handover is what the redundant library provides: after a switchover the other subsystem's CP takes the transactions and the two masters never drive the bus at the same time. Test it deliberately — force a switchover while a request is outstanding, then confirm the next request completes and the receiving logic flagged the gap. Any register value carried over from before the switchover stays stale until a fresh reply replaces it.