IMDHMIControls LibraryShop main store

Explainer

Modbus TCP client roles in a redundant S7-1500 system

Industrial networks Published 8 min read

Short answer

The field instruments are the Modbus TCP servers; each S7-1500 CPU in the redundant pair is a client that polls them over MB_CLIENT. The ET 200SP stations stay on PROFINET configured I/O and never enter the Modbus design; SCADA connects to the PLCs and reads and writes PLC variables only. Give each instrument connection exactly one owning CPU and route operator writes through one PLC command interface.

On this page
  1. The four roles in this architecture
  2. PROFINET I/O and Modbus registers never mix
  3. How the client polls a server
  4. Worked example: mapping a flow instrument's 32-bit total at reference 40011 into one Modbus request
  5. One owner per connection in the redundant pair
  6. SCADA reads and writes PLC variables, not instruments
  7. Bring the system online one transaction at a time
  8. Questions asked

Three conversations run in this architecture and each has its own pair of roles. The ET 200SP stations exchange process data with the CPUs as PROFINET configured I/O. The field instruments speak Modbus TCP, where they are the servers and the redundant S7-1500 pair is the client: the CPUs ask, the instruments answer. The SCADA PC talks only to the PLCs, reading and writing PLC variables through its controller connection. Lock those roles in and the redundancy question shrinks to one rule: each instrument connection gets exactly one owning CPU, and every operator write to an instrument passes through one PLC command interface. The sections below assign the roles, work one instrument register end to end, and give a commissioning order that catches a swapped role before it reaches the process.

The four roles in this architecture #

Split the plant by protocol before opening any configuration tool. Modbus TCP is a request-response protocol carried over TCP: a client opens a connection, sends a request naming a function code, a start address and a quantity, and the server answers with data or an exception. PROFINET I/O is different in kind: the IO controller and each IO device exchange a fixed process image on a cycle set by the configuration, with no request from the program at all. A shared switch, or even a shared CPU port, does not turn one data model into the other.

Equipment Role on the wire What the program works with
3 ET 200SP stations PROFINET devices exchanging configured I/O Process-image input and output addresses from the hardware configuration
Field instruments Modbus TCP servers Coils and registers exactly as each instrument manual defines them
2 S7-1500 CPUs, the redundant pair Modbus TCP clients for the instruments, PROFINET IO controller for the stations Request buffers, decoded instrument values, connection status
SCADA PC Controller connection to the PLCs PLC variables only

When something breaks, read the table left to right: the wire role tells you which configuration tool and which manual apply.

PROFINET I/O and Modbus registers never mix #

The roughly twenty I/O points on each ET 200SP station arrive at fixed input and output addresses in the hardware configuration, and the CPUs read and write them through the process image every cycle. No register map, no function code and no Modbus client belong to this path. When a station faults or drops out, the fault lives in its PROFINET configuration or cabling, and no amount of Modbus programming repairs it, so bring the PROFINET picture healthy before building the instrument side on top.

One physical CPU port carries both conversations at once, and the page on running Modbus TCP and S7 communication together on one CPU port explains how the two protocols share a single interface without touching each other's data.

How the client polls a server #

The instrument is the server because it is the device that puts data up for the asking: it listens for TCP connections on port 502, the usual Modbus TCP server port in Siemens' documentation, and answers every request with data or an exception. The CPU is the client and drives every transaction. In the PLC that is the MB_CLIENT instruction, one instance with its own data block per instrument connection: the instruction establishes the connection, sends the request, receives the response, and its DISCONNECT parameter lets the program control connecting and disconnecting. Each concurrent connection needs its own connection ID and its own local port number, which Siemens' Modbus documentation takes from 2000 upward on the client side.

Build one polling cycle per instrument: a read request for the registers the process needs, run on a timer, with each response decoded into named PLC variables and the connection status stored beside them. For the parameters step by step, the walkthrough of connecting an S7-1500 to Modbus TCP in TIA Portal covers the MB_CLIENT setup end to end. When reads from one instrument work alone but stop the moment a second connection is added, the usual suspect is the failure described in the page on two MB_CLIENT instances stopping Modbus TCP reads from one server.

Worked example: mapping a flow instrument's 32-bit total at reference 40011 into one Modbus request #

Inputs, as a typical case for this architecture: one of the several Modbus TCP instruments, here a flow computer. Its manual prints one line of the register map: reference 40011, totalized volume in cubic meters, 32-bit floating point, 2 registers, read-only. The instrument serves Modbus TCP at 192.168.1.61, an example address, on port 502. The CPU reads it with function code 3, read holding registers, inside an MB_CLIENT instance.

Rule in words: a manual that numbers holding-register references from 40001 upward uses the Modicon convention, in which the address inside the actual request equals the printed reference minus 40001. A 32-bit value occupies two consecutive registers, so the request must fetch both, and the manual's word order statement decides how the two 16-bit words reassemble.

Arithmetic: 40011 minus 40001 is request address 10, and a quantity of 2 covers registers 10 and 11. Two registers of 16 bits reassemble to 32 bits, which is 4 data bytes in one response. The MB_CLIENT call therefore targets 192.168.1.61 on port 502 with function code 3, start address 10 and quantity 2, and stores the 4 returned bytes as one floating-point value in the word order the manual specifies.

Decision: apply the translation rule per manual. References printed in the 40001 style lose 40001 and become 0-based request addresses; a manual already printing bare addresses from 0 is used unchanged. Prove the rule on this one register before mapping anything else, because a translation off by one succeeds and returns a plausible-looking wrong number, which is far harder to notice than a timeout. The register here is read-only, so the proof costs nothing.

One owner per connection in the redundant pair #

Two CPUs do not mean two pollers. Give each instrument connection exactly one owning CPU and let the redundancy logic hand ownership over on a switchover. Both CPUs polling one instrument doubles that server's connection load, and every server has a finite connection capacity that the instrument manual usually states. It also invites the worse problem: two writers reaching one command register with no coordination. Uncoordinated duplicate writes are wrong practice in any protocol, because both transactions can report success while the instrument ends in a state neither writer intended.

Design the handover so the CPU that becomes active establishes or resumes each owned connection before polling restarts; a TCP connection belongs to the CPU that opened it, so never assume it rides through a switchover untouched. Route every instrument write through one PLC command interface: SCADA writes a command variable, the owning CPU's logic checks range and permissives, and only that logic issues the Modbus write. Match retry behavior to the command, since re-reading a register is always safe while re-sending a start command after a lost response can act twice. Machine safety functions stay out of this entirely, on dedicated safety hardware, never on a Modbus register or a supervisory link.

If the contract also names Modbus TCP server ports for the redundant pair, budget that as its own configuration effort with its own connection parameters; the client work here does not stand in for it. The same one-owner pattern holds when the remote devices speak serial Modbus instead: the page on linking a Modbus RTU BMS to a redundant S7-1500R works the identical question of who owns the link and whom SCADA talks to.

SCADA reads and writes PLC variables, not instruments #

The SCADA connection targets the PLCs, not the instruments: it reads the ET 200SP values through the process image and the instrument values through the decoded PLC data, giving operators one supervisory model. The decision for this architecture is absolute: the PLC owns every instrument conversation and SCADA owns none of them. If a second consumer genuinely needs an instrument directly, that is a separate branch with its own connection-capacity and write-ownership checks, not a shortcut bolted onto this design.

Expose each instrument value to SCADA with its health: a communication-status bit and a data age, meaning the elapsed time since the last successful poll. A healthy CPU does not prove current measurements, and a stored value from a dead instrument link is the classic redundancy blind spot. Operator writes land as PLC variables and reach the instruments only through the command interface above.

In a redundant pair the SCADA station must reach both CPUs, and a station that sees exactly one of them is a standard commissioning fault; the page on troubleshooting a SCADA PC station that reaches only one S7-1500 walks that fault down.

Bring the system online one transaction at a time #

Commission in this order, and each step proves the one before it:

  1. Hardware configuration first: all three ET 200SP stations at their addresses with a healthy process image and no station fault.
  2. One instrument, one connection: a single MB_CLIENT instance, a single read, verified against a register with a known value as in the worked example above.
  3. Replicate the proven pattern to the remaining instruments, each with its own connection ID and local port.
  4. Switchover: force a handover and confirm every owned connection returns and every owned value shows a fresh timestamp.
  5. SCADA last: tags, alarms and command variables only once the PLC side is proven.
Observed result What it means Where to look next
No response, repeated timeout The exchange never completed Endpoint settings, network path, the instrument's connection capacity
Modbus exception response The server received the request and rejected it Function code, address, quantity, write permission
Successful response, implausible value Transport works, interpretation is wrong Address translation, word order, data width, scaling

An Ethernet link LED proves only that a cable is live; it says nothing about TCP connectivity or register selection. The last table row is the dangerous one, which is why the known-value register in the worked example comes before any bulk mapping. The decision for the whole architecture, then: PROFINET configured I/O for the ET 200SP stations, Modbus TCP with the CPUs as clients for the instruments, SCADA against PLC variables only, one owning CPU per instrument connection, and one command interface for every write.

Questions asked

How many registers can one Modbus TCP read request return?

The Modbus protocol allows up to 125 registers in one read response, which is 250 data bytes per transaction. Because a 32-bit value occupies two consecutive registers, a single request returns at most 62 complete 32-bit values, with one register left over. Split a long register map across several requests in the same poll cycle; each request still needs its own correct start address.

Which Modbus function codes read, and which write?

Codes 1 and 2 read coils and discrete inputs, codes 3 and 4 read holding and input registers, code 5 writes a single coil, code 6 writes a single holding register and code 16 writes a block of registers. Instruments accept writes almost always only in holding registers, and many command registers demand a sequence, for example a setpoint written before a trigger bit, so follow the manual write conditions exactly.

How do I prove the Modbus links survive a switchover?

Force the handover during commissioning: stop the active CPU and watch the instrument side, where a count of open client connections, if the instrument exposes one, should drop and climb back as the incoming CPU re-establishes each owned connection. Watch the PLC side too: every owned instrument value must show a fresh timestamp after the switchover. Repeat the test with a write command queued, so you learn how each command behaves when its response is lost.

Can SCADA poll the instruments directly instead of going through the PLC?

It can, but then every instrument value lives twice: a decoded copy in the PLC and a driver copy in SCADA, each aging on its own schedule, and any direct SCADA write skips the PLC range checks and permissives. If a second consumer genuinely needs an instrument directly, first confirm the instrument limit on simultaneous client connections, and never let two writers reach the same command register.

Keep reading

  • How-to

    Linking Modbus RTU BMS SCADA to a redundant S7-1500R

    Use one Modbus RTU-to-TCP gateway as the Modbus TCP client, and run the Modbus TCP server on the S7-1500R system IP address that switched communication moves to the surviving CPU. The BMS keeps polling its RS-485 link unchanged; on a switchover the TCP session drops and the gateway reconnects. Set the comm-fail timeout to the measured gap plus one poll interval: 3 s at a 1 s rate in the example.

    Industrial networks

  • Troubleshooting

    Why an S7-1500 X2 Modbus server accepts TCP but no DONE arrives

    The client's 0001-to-7005 loop means it builds a connection, sends a request and never receives an accepted response; the completed 7006 state and DONE never arrive. A blank Telnet session proves only that X2 accepts TCP on port 502. Match TCON_IP_v4.InterfaceID to X2's hardware identifier from device configuration, then read the one-scan ERROR and STATUS with a trace.

    Industrial networks

  • Explainer

    CP 443-1 Modbus TCP server limit and the FB108 call pattern

    Yes — with the S7-OPENMODBUS/TCP V5.x package (2XV9450-1MB00) in STEP 7 V5.5 SP4, one CP 443-1 polls several Modbus TCP servers: one NetPro TCP connection and one FB108 instance DB per server. The ceiling is the CP's documented 64-connection total minus every connection it already carries, or the package's stated connection count if that is lower.

    Industrial networks