Problem Overview
The MB_CLIENT instruction on Siemens S7-1200, S7-1500, and S7-1200 G2 CPUs running a Modbus TCP client toggles continuously between BUSY = TRUE, DONE = FALSE, ERROR = FALSE and BUSY = FALSE, ERROR = TRUE with the output parameter STATUS cycling primarily between 7005 and 80C3 (hexadecimal). The user data buffer mapped to the DATA_PTR input remains at 16#0000 across every scan cycle. Intermittent 7006 (waiting for response), 7009, or event word status codes may appear in the instance DB monitor without ever producing a DONE = TRUE edge.
MB_CLIENT wrapper. The 7005 state confirms the block is actively transmitting; the 80C3 state is a connection-layer fault returned by the TCON/TDISCON resource. They alternate because the client retries on every call without ever completing a handshake.Technical Background: Status Code Decoding
The MB_CLIENT STATUS output is a 16-bit WORD in which two distinct encoders feed the value depending on operating state. When the block is mid-transaction, STATUS carries the Modbus job progress; when an exception occurs, it carries the underlying PROFINET/TCP error code. The 7005/80C3 pair must be interpreted as separate events, not a single code.
| STATUS Code | Source Layer | Meaning | Documented Source |
|---|---|---|---|
16#7005 |
Modbus job scheduler | Data is being sent. Check the connection to the Modbus server. The job request frame has been handed to the TCP stack and a reply is awaited. | Siemens TIA Portal V21 — Parameter STATUS, MB_CLIENT |
16#80C3 |
Open User Communication (TCON) | Connection establishment aborted. The local connection resource (ID) is already in use, the remote partner rejected the SYN, or the passive partner is unreachable on the configured port. | STEP 7 Online Help — TCON error codes |
16#7006 |
Modbus job scheduler | Waiting for response from the Modbus server. | Siemens TIA Portal — Parameter STATUS, MB_CLIENT |
16#8180 |
MB_CLIENT | Modbus server response received but the requested data length does not match the buffer (MB_DATA_LEN vs DATA_PTR size). | Siemens TIA Portal — Parameter STATUS, MB_CLIENT |
16#8181 |
MB_CLIENT | Modbus function code or unit identifier not supported by the configured server. | Siemens TIA Portal — Parameter STATUS, MB_CLIENT |
16#818C |
MB_CLIENT | Pointer DATA_PTR does not point to a valid global DB or bit memory with sufficient size. |
Siemens TIA Portal — Parameter STATUS, MB_CLIENT |
16#80A1 |
TCON | Connection cannot be established because the partner is not responding at the configured remote port. | STEP 7 Online Help |
7005 followed by 80C3 at the cycle boundary indicates the Modbus job scheduler opens the request, the TCP stack rejects the connection, and the next cycle begins again. The data buffer stays zero because no MB_PDU response frame has ever been parsed.Root Cause Analysis
Five independent root causes can produce this oscillation on a Siemens S7-1200. Field data and the official Siemens library documentation isolate them into the following ranked matrix.
| # | Root Cause | Diagnostic Evidence | Impact Severity |
|---|---|---|---|
| 1 |
Connection-ID (TCON_ID) collision with another TCON, MB_CLIENT, MODBUS-TCP-Connect block, or unused legacy connection resource. |
STATUS alternates 7005/80C3 from cycle 1; online TDIAG view shows the local endpoint as Local ID in use or partner unreachable. |
High — block can never handshake. |
| 2 |
Modbus register addressing off-by-one or wrong data type on the server side (e.g., addressing 40001 for a server that stores the value at 40000, or querying 4xxxx as INT while the server exposes FLOAT). |
Handshake succeeds on a Modscan client, data buffer still zero on the PLC; STATUS occasionally shows 8180 or 8181. |
High — 7005/80C3 is forced when the server closes the TCP stream mid-PDU. |
| 3 | Swapped or broken Ethernet cable, hub/switch port duplex mismatch, or VLAN filtering blocking return packets. | Direct connection to a laptop with Modscan succeeds; connection through the production switch fails. Connection diagnostic page shows no partner reachable. |
Medium — physical path. |
| 4 | Server not listening on the configured port (default 502). Some energy or building-automation servers require an explicit register for the unit/slave ID. | Status remains 7005 for several seconds before flipping to 80C3; Modscan on the same TCP port replies with connection refused. | Medium — server-side. |
| 5 |
MB_UNIT_ID not matching the server's expected unit identifier for Modbus-TCP gateway scenarios. Some MQTT-to-Modbus bridges ignore MB_UNIT_ID, others strictly enforce it. |
Modbus exception code 02 or 0A is returned by the server, which the MB_CLIENT translates into the alternating 7005/80C3. |
Medium — semantic mismatch. |
Prerequisites
- STEP 7 Basic / Professional V16 or later, TIA Portal V17/V18/V19/V20/V21 supported. Library
Modbus_TCP_CPV4.0+ for S7-1200, V3.x+ for S7-1500 must be installed. - Target CPU firmware: S7-1200 V4.0+ (article applies to S7-1200 G2 with the same library block).
- Online connection to the PLC (Ethernet, PG/PC interface).
- A second TCP testing tool such as ModScan32 or open-source libmodbus for cross-validation of the server's register map.
- Wireshark or the TIA Portal online
Online & Diagnostics > PROFINET > Connectionsview to capture the TCP handshake.
Diagnostic Procedure
Follow the procedure in order. Each step produces a binary decision (pass/fail) that points to the matching solution section.
-
Capture the live STATUS. In TIA Portal, open the
MB_CLIENT_DBinstance data block in Monitor/Modify mode and select Update in watch. Confirm thatSTATUSflips betweenW#16#7005andW#16#80C3on every PLC cycle. -
Verify the connection resource. Navigate to Project tree > PLC > Devices & networks > X1 / X2 > PROFINET interface > Properties > Ethernet addresses. Open Connections and locate the entry whose Local ID matches the value at the
CONNECTinput ofMB_CLIENT. Each ID must be unique across the project. -
Test against a reference Modbus server. Use Modscan on the engineering PG to query the same registers the
MB_CLIENTis configured for. If Modscan reads valid values, the server is healthy. -
Cross-check the data type. Confirm whether the server stores the target register as
INT,REAL,WORDor as a 32-bit double register (CDAB / ABCD byte order). Mismatch here triggers Siemens MB_CLIENT8181replies. -
Capture the TCP stream. Start Wireshark on the same VLAN, filter for
tcp.port == 502. A successful Modbus transaction showsSYN,SYN-ACK,ACK, MB request PDU, MB response PDU,FIN. If onlySYNretransmits are observed, the partner does not respond. -
Verify the MB_UNIT_ID. Many SIPROM, ABB and Schneider power-meter servers require a specific Unit Identifier (often
255or0). The DB parameterMB_UNIT_IDmust match.
Solution 1 — Connection Identifier Collision
This is the most common field fix and is the one that resolved the original case study. A TCON connection resource index is consumed by the first Ethernet instruction that references it. Two MB_CLIENT instances configured with CONNECT = 1, or an MB_CLIENT paired with an MB_SERVER or a TSEND_C block sharing CONNECT = 1, will both attempt to bind to the same local endpoint and the TCP stack rejects the second.
- In TIA Portal open Project tree > PLC > Devices & networks.
- Click the CPU, then Properties > Ethernet addresses > Connections.
- Rename the local ID of the failing
MB_CLIENTfrom1to a free slot —5,10, or any unused value. - Open the
MB_CLIENTinstance and update theCONNECTinput to the new local ID. - Compile (Hardware + Software) and download to the CPU.
After the change the block must be re-initialized. Insert a one-shot rising edge into the REQ input or call MB_CLIENT(REQ := bStart) once after restart so a fresh TCON occurs.
Solution 2 — Data Type and Register Address Mismatch
If Modscan returns the expected values but the MB_CLIENT still fails (often with periodic 8180/8181 flashes in the same cycle), the register model the PLC expects is different from the server reality.
- For floating-point values, ensure the
DATA_PTRpoints to aREALtag (4 bytes) and thatMB_DATA_LENis set to 1 register pair, i.e., value2. For 16-bit values useINT/WORDandMB_DATA_LEN = 1. - Verify the byte order. Some energy meters (Schneider Electric PM5xxx, ABB M4M 30) return CDAB floating-point format. If
DATA_PTRpoints toREALand the value reads0.0with valid Modscan output, swap high/low word with twoWORDreads followed by a byte-swap function block. - Validate the register address. Most servers use 0-based holding-register offsets starting at address
40001. Some PLC-side libraries (legacy Modbus-TCPMB_CLIENTV3.x) expect 1-basedMW0-style offsets and expose40001as0. IfMB_DATA_ADDR = 1(40001) returns 0 butMB_DATA_ADDR = 0or2returns the right value, change the address by 1.
Solution 3 — Physical Layer and Switch Configuration
- Swap the Ethernet patch cord; pinout must be TIA-568A or TIA-568B consistently end-to-end. Use a known-good Cat 5e or Cat 6 cable of less than 100 m.
- Force both the S7-1200 and the server to 100 Mbps / Full Duplex on the switch port if autonegotiation fails. ProSet/managed switches expose this as Port Speed & Duplex > Force 100Fdx.
- Disable Energy Efficient Ethernet (EEE, IEEE 802.3az) on the switch port — some S7-1200 firmware revisions historically handle EEE pause frames incorrectly and the link resets every few seconds.
- Confirm any VLAN tagging — if the server sits in VLAN 20 and the PLC port is VLAN 1 untagged, the Modbus PDU never returns.
Solution 4 — Direct MB_UNIT_ID Override (Advanced)
This technique was reported as a workaround for stubborn Modbus gateways that ignore MB_UNIT_ID in the request PDU but require a specific unit on the response side. Use only when both solutions 1 and 2 are exhausted.
- Open System blocks > MB_CLIENT_DB in TIA Portal.
- Switch the DB to Manual (uncoupled from the program).
- Edit the static tag
MB_UNIT_IDto the value the server expects (commonly1,255, or the unit-slot of a daisy-chained RTU). - Re-compile and download only the DB, then restart the
MB_CLIENTby togglingREQ. - Once handshake succeeds, snapshot the data and put the DB back into program-control so future re-deployments do not overwrite the manual edit.
MB_UNIT_ID via the HMI or data block initialization.Verification
- Set a trace on
MB_CLIENT_DB.STATUS,MB_CLIENT_DB.BUSY,MB_CLIENT_DB.ERRORandMB_CLIENT_DB.DONE. - Force
REQwith a single-cycle rising edge. - Confirm the trace shows one pulse of
BUSYfollowed by a cleanDONEedge within the configured Modbus timeout (default 5 000 ms). - Confirm
STATUSends atW#16#0000after theDONEpulse. The buffer must contain the expected value. - Repeat the cycle ten times consecutively; any reappearance of
80C3indicates the underlying root cause has not been fully resolved.
Related Status Codes Reference
| Hex Code | Source | Meaning | Recommended Action |
|---|---|---|---|
| 7000 | MB_CLIENT | Idle, no job pending. | None. |
| 7001 | MB_CLIENT | Job pending, waiting for trigger. | Verify REQ edge detection. |
| 7002 | MB_CLIENT | Job triggered, queued. | None, normal transient. |
| 7003 | MB_CLIENT | Sending request via TCP stack. | None, normal transient. |
| 7004 | MB_CLIENT | Awaiting server response (pre-send). | None, normal transient. |
| 7005 | MB_CLIENT | Data is being sent. | Check partner reachability; expected single cycle. |
| 7006 | MB_CLIENT | Waiting for response from server. | Check timeout; if persists, verify server is alive. |
| 80C3 | TCON | Connection resource already in use or partner unreachable. | Reassign CONNECT Local ID; verify partner port. |
| 80A1 | TCON | Connection cannot be established; partner not responding. | Verify Ethernet cabling, IP address and port. |
| 8180 | MB_CLIENT | Data length mismatch. | Verify MB_DATA_LEN vs DATA_PTR size. |
| 8181 | MB_CLIENT | Function code/Unit ID not supported. | Verify MB_UNIT_ID and server capabilities. |
| 818C | MB_CLIENT | Invalid DATA_PTR. |
Point to valid global DB / bit memory of sufficient size. |
Troubleshooting Matrix
| Observed Symptom | Most Likely Cause | First Action |
|---|---|---|
| Alternates 7005 / 80C3 from cycle 1, never touches 7006. | Connection-ID collision. | Reassign CONNECT to a free local ID. |
| Reaches 7006 before flipping to 80C3. | Server reachable but handshake aborts mid-PDU. | Verify data type and length matching. |
| STATUS oscillates 7005 / 80C3 only after a few seconds. | Server port is unreachable or filtered. | Verify port 502 (or custom) and firewall rules. |
| STATUS = 80A1 instead of 80C3. | Server silently discards or stops responding. | Inspect server CPU load; reboot server. |
| Data buffer never updates even when STATUS = 0000. |
DATA_PTR points to wrong area. |
Confirm pointer target and length. |
Common Field Pitfalls
- Using the same Ethernet port for PROFINET IO and Modbus TCP without enabling the PROFINET interface for open communication — by default, S7-1200 blocks open TCP traffic on the same IP used for PROFINET when the controller is a PROFINET device; remap to a second IP / second interface where available.
- Configuring
MB_DATA_ADDRin holding-register offset mode while the server expects the legacy Modicon 4xxxx base — always confirm with the server's register map PDF. - Forgetting that
MB_CLIENTrequires a positive edge onREQfor each transaction. HoldingREQ = TRUEcauses one execution followed byERROR = TRUEand a status flip. - Using
MB_CLIENTfrom a library version older than 4.0 on S7-1200 V4.5 firmware; cross-version conflicts lead to80C3even on a healthy network.
FAQ
What does MB_CLIENT status 7005-80C3 mean on an S7-1200?
The PLC is actively transmitting Modbus PDUs (7005 = "Data is being sent"), but the underlying TCON connection layer reports 80C3, meaning the TCP connection was aborted — typically because the connection-ID is already bound by another block, the partner is unreachable, or the Modbus server closed the socket mid-frame. Treat 80C3 as the real fault and 7005 as the cycling symptom.
Why does the data buffer stay at zero even though BUSY is true?
No Modbus response PDU has ever been parsed. Because the TCP handshake fails immediately, the server never writes into the response frame, so DATA_PTR is never updated. The buffer reflects the initial value of the destination tag (zero by default).
How do I fix a connection-ID collision in MB_CLIENT?
Open PLC > Properties > Ethernet addresses > Connections and rename the local ID used by the failing MB_CLIENT to a free slot such as 5 or 10, then update the CONNECT input of the MB_CLIENT call to match. Recompile and download both hardware and software.
Does changing the Modbus data type on the server-device resolve 7005-80C3?
Often yes. If the server exposes the same register as INT instead of REAL, the PLC expects 4 bytes but receives 2; the server can reset the connection in response to the malformed function code. Re-type the register on the server to match the PLC's expected type (e.g., set to 16-bit signed INT with MB_DATA_LEN=1).
Can I safely edit MB_UNIT_ID directly in the MB_CLIENT_DB?
Yes, but only as a temporary diagnostic step. Open the instance DB in TIA Portal, switch it to manual/uncoupled, write the new MB_UNIT_ID, download only the DB, then put the DB back under program control. It is not a permanent configuration path and may break if you later re-download the software.