Explainer
Why a Modbus TCP camera cannot write into an S7-400 DB
Short answer
The camera is a Modbus TCP server and a DB is passive PLC memory, so nothing pushes the measurements in: a Modbus TCP client must poll the camera and map the response into the block. On an S7-417-4H that client runs on a CP 443-1 with Siemens' Modbus/TCP blocks; OPC UA is a different protocol and relocates the client to a gateway instead of removing it.

On this page
- Why can't the camera write its data into the DB by itself?
- Is a communication processor compulsory on the S7-417-4H?
- How do you set up the CP 443-1 as a Modbus TCP client?
- How do two 16-bit registers become one REAL in the data block?
- Is OPC UA an alternative to the CP 443-1?
- How should the client run so the DB stays fresh?
- Which data path should you build?
- Questions asked
The camera is already doing its full share of the work: it answers Modbus TCP requests, and your test software proved that. The missing half is on the PLC side. A data block in the S7-417-4H is passive memory, and nothing fills it from outside until a Modbus TCP client polls the camera and a program maps the response into the block. The supported way to give an S7-400 that client is a CP 443-1 communication processor running Siemens' Modbus/TCP blocks; an S7-300 communication processor does not fit the rack, and OPC UA is a separate protocol that relocates the Modbus client into a gateway instead of removing it. Below is the whole data path, from protocol roles to register mapping to the build decision for this machine.
Why can't the camera write its data into the DB by itself? #
A Modbus TCP server only answers requests, and a DB is passive PLC memory, so nothing in the camera pushes values into the S7-417-4H: the data moves only when a Modbus TCP client polls the camera and maps the response into the block. Modbus TCP splits the work strictly. The client opens a TCP connection to the server's port 502, sends a request carrying a function code, a start address, a register count and a unit identifier, and the server answers with data or an exception. A server never initiates traffic.
Because the camera answered your test software, it is a server, and that successful poll is the blueprint for the PLC side. Record the camera's IP address, the configured port, the unit identifier, the function code, the start address and the register count from the working setup before changing anything. A few cameras can also run as a Modbus client and push their values, but that only moves the problem: the S7-400 would then need a Modbus TCP server, again a CP function, and the register-to-DB mapping work is identical. Treat the camera as a server and poll it.
Is a communication processor compulsory on the S7-417-4H? #
Yes: put a CP 443-1 in the rack, because Siemens documents the Modbus/TCP client for the S7-400 on that CP, and an Ethernet port by itself executes no Modbus transactions — transport and protocol are separate things. The 417-4H's integrated PROFINET interface is documented for PROFINET, S7 connections and open TCP transfers; building Modbus on a raw socket there is custom programming, not a supported client. The documented S7-400 answer is the external communication processor: the Modbus/TCP package Siemens provides for S7-300 and S7-400 stations runs on a CP 343-1 in an S7-300 rack and on a CP 443-1 in an S7-400 rack. An S7-300 card, lean or otherwise, cannot sit in an S7-400 rack, so the part to plan is a CP 443-1 whose exact variant and firmware appear on the Modbus/TCP block documentation's compatibility list.
On the redundant pair, the CP occupies a slot in one node's rack. Decide where the client lives after a switchover — one CP in the node your fallback concept keeps as master, or one per node with the connection re-established — and prove it by forcing a switchover with polling active.
How do you set up the CP 443-1 as a Modbus TCP client? #
In a STEP 7 classic project, double-click Connections at the S7-400 station to open the connection configuration in NetPro; in a TIA Portal project the camera's IP address goes in the Inspector window under Properties > General > General, and the connection's local ID under Properties > General > Local ID. The Modbus/TCP blocks Siemens supplies for these CPs reference that local ID when they open the connection, so the hardware configuration and the program must agree on it.
In the CPU program, call the client block with the transaction you recorded: the unit identifier, function code, start address and register count of the successful test poll, with the camera's address and port from the connection configuration. Wire the block's done, busy and error outputs to your control logic, compile, and load the CP and the CPU together. Then repeat the test the test software already passed: the same registers, read from the PLC, must return the same values.
How do two 16-bit registers become one REAL in the data block? #
Two consecutive 16-bit registers carry one 32-bit REAL: a request for N registers returns 2 × N raw bytes, so a two-register float fills exactly one double word in the DB once the camera's word order is confirmed against a known value. Align the numbering first: the camera manual's register labels and the transmitted addresses can differ by the convention, a 0-based protocol address against a 1-based register number, so reproduce the start address that already works instead of converting from the manual. Then settle four documented properties per value: data type, scaling, byte order inside each register, and word order across register pairs.
Worked example, illustrative: the camera delivers a temperature as an IEEE 754 REAL across two registers, and the test client shows 0x42C8 followed by 0x0000. High word first assembles 0x42C80000: sign 0, exponent field 0x85 = 133, so 133 − 127 = 6; mantissa 1 + 0x480000/0x800000 = 1.5625; 1.5625 × 2^6 = 100.0. The measurement is 100.0. Assemble the same words low word first and you get 0x000042C8, a denormal near 2.4E-41, which displays as zero — the classic symptom of a DB that stays at zero — and the fix belongs in the copy mapping, swapping the two words, not in the camera address. If a register is documented as an integer in tenths of a degree, raw 235 converts with INT to REAL divided by 10.0, giving 23.5.
Lay the DB out so every field has a type, a source register range and a destination with no overlapping writes, and receive into a staging area first. A ten-register reply is 20 bytes of payload, ten words, before any status the communication blocks add.
Is OPC UA an alternative to the CP 443-1? #
No: OPC UA is a separate client/server protocol, not a conversion setting — the camera's only interface is Modbus TCP on port 502, so an OPC UA route still needs a Modbus TCP client, just relocated into a gateway or a PC. OPC UA brings its own security and information model; no address change turns a Modbus device into an OPC UA device. On this PLC the point is sharper: S7-400 CPUs have no embedded OPC UA server, a capability of newer CPUs covered for when an S7-1500 needs no SIMATIC PC Station for OPC UA, so an OPC UA server here runs on a PC and must itself drive a Modbus TCP client to reach the camera at all.
OPC UA then adds a server, a client and a mapping to a job the CP 443-1 does in one hop. Choose it only where the site already standardizes on an OPC layer; for one camera into one DB it is the long way around.
How should the client run so the DB stays fresh? #
Run the client one job at a time on a fixed cycle — 500 ms suits most measurement polling: give the client block a trigger edge, wait for its done or error bit, and only then copy the receive buffer into the process DB behind a validity flag and a counter. Never fire a new request every scan; a cyclic program coordinates the asynchronous transaction instead of overlapping it.
Keep communication status next to the values: on error, leave the last value in place but clear validity and stop the counter, so a value frozen by a pulled cable is distinguishable from a genuinely steady measurement. On the redundant pair, force a switchover with polling active and confirm the client re-establishes; a healthy read in normal operation proves nothing about the H state. One safety line: a camera value over standard Modbus TCP is production data, and any safety function keeps its own path under the machine's risk assessment.
Which data path should you build? #
Build the CP 443-1 path: one camera, one DB and a redundant S7-400 with a free slot make the in-rack client the shortest supported route, and the alternatives pay off only when several Modbus devices or an existing OPC layer change the arithmetic. The decision per case:
- Case A, this machine as described: CP 443-1, the Modbus/TCP blocks, a staging area, the mapped DB and a validity flag. No extra box, no extra protocol, and the client runs with the PLC program.
- Case B, several Modbus devices or no slot for the CP: a gateway or an industrial mini PC in the cabinet polls the camera and writes the DB over an S7 connection — the same client/server logic moved out of the PLC, as in setting up a CODESYS Modbus TCP client to talk through a gateway. An HMI already on the machine can do it when it writes device data into an S7-400 DB with an external tag, provided it stays in run.
- Case C, a site that already runs an OPC layer: let the OPC UA server poll the camera through a Modbus driver and feed its clients; that is architecture, not a shortcut for one camera.
For this S7-417-4H and this camera, the build is Case A: a CP 443-1, the Modbus/TCP client blocks polling the recorded transaction, a staging area, and a mapped DB that carries validity with every value.
Questions asked
Which function code does the camera use for its measurement registers?
Measurement values live in holding registers, read with Modbus function 03; some maps expose discrete bits through function 01 or 02 instead. Do not guess: open the working request in your test software and copy its function code, unit identifier, start address and register count into the client block, because the transaction that already succeeds is the one the CP must repeat.
Can the same CP 443-1 also act as a Modbus TCP server for other masters?
Yes. The Modbus/TCP package for these communication processors covers both roles, and commissioning decides which the card performs, so the same hardware can later answer other Modbus masters. Budget the connection resources of the exact CP variant and firmware before mixing heavy polling in both directions on one card.
Can an operator panel move the data instead of a CP?
Often yes. Many panels poll Modbus TCP as a client and write the S7-400 DB with an external tag, which removes the CP from the parts list. The catch is availability: the values stop updating whenever the panel is switched off, rebooted or loses its project, so this suits indication and logging, while control logic that must not go stale belongs on the PLC's own client.
Does the unit identifier matter when the camera hangs directly on the TCP network?
The Modbus TCP frame still carries a unit identifier even without a serial gateway behind it. Many TCP-native servers accept any value, others answer with an exception unless it matches their configuration, so repeat exactly what your working test client used. If polls fail while the connection itself is clean, this byte is the first thing to compare.


