IMDHMIControls LibraryShop main store

Troubleshooting

Why MB_MASTER on an S7-1200 reports Modbus error 16#8188

PLC programming Published 5 min read

Short answer

Error 16#8188 on an S7-1200 MB_MASTER is an operating-mode fault, not a serial link failure. Set MODE 1, DATA_ADDR 30001, a length of 32 and MB_ADDR 1 to read the slave's D000 through D01F block as input registers 30001 through 30032, and hold EN TRUE through the REQ pulse.

On this page
  1. What 16#8188 reports on MB_MASTER
  2. Convert D000 through D01F to Modbus references
  3. The call that reads the block
  4. Bench test before you widen the program
  5. The decision for each case
  6. Questions asked

Error 16#8188 on an S7-1200 MB_MASTER is the instruction's operating-mode fault: the MODE value in the call is not one the instruction accepts, so nothing is put on the RS485 line. Your second problem is notation. The slave map's D000-to-D01F labels are that vendor's register-map references, and MB_MASTER wants a standard input register reference in the 30001-to-39999 band. The fix is one call: MODE 1 with DATA_ADDR at the block's first reference, a length of 32, MB_ADDR 1, and EN already TRUE before the REQ edge. On a CPU 1212 DC/DC/DC with firmware V4.7 and a CM 1241 RS485 that reads the whole D000 block in one transaction; no module setting changes anything.

What 16#8188 reports on MB_MASTER #

The Modbus RTU error list for the S7-1200 and S7-1500 defines 16#8188 as an invalid operating mode, and it also fires when a broadcast is requested with MB_ADDR 0 and a MODE other than 1. In both cases the instruction rejects the parameter combination while it validates the call, before any frame reaches the wire. That matches the pattern you hit: MODE 0, MODE 11 and MODE 104 all returned the same code, because 11 and 104 are not MODE values this instruction defines, and MODE 0 points the call at holding registers, not at the input registers you want.

On MB_MASTER, the MODE parameter and the Modbus address together determine the function code the slave sees. MODE 1 with a 3xxxx reference is the input-register read, function code 04, which is why mode and address have to agree: a valid mode pointed at a register type it does not drive produces the same rejection as an invalid mode.

One distinction before you change anything. 16#8188 is not the same fault as a call that cycles DONE and ERROR with valid inputs but brings no data back; if that is your symptom, work through why MB_MASTER returns an error status but no data instead. The two fixes do not overlap.

Convert D000 through D01F to Modbus references #

MB_MASTER validates input register references against the standard band 30001 to 39999. The slave vendor's D labels name registers inside its own map; they are not protocol references, so convert them before they reach DATA_ADDR. Worked example for a block labeled D000 to D01F, where the notation makes the suffix hexadecimal:

  • 0x01F = 1 × 16 + 15 = 31, so the block is 32 registers at offsets 0 through 31.
  • The first register sits at offset 0, so its reference is 30001.
  • The last register is 30001 + 31 = 30032, inside the valid band.

The conversion that fails is treating the label itself as a number. Hexadecimal D000 is 13 × 4096 = 53248 in decimal, and 53248 lies outside 30001 to 39999, so the instruction rejects the reference exactly as you reported. The decimal value of the D label is never the DATA_ADDR; the map offset added to the band's first reference is.

The call that reads the block #

Set the four inputs this way and the request is valid before it is made:

Input Value Why
MODE 1 selects the input-register read, function code 04
DATA_ADDR 30001 first reference of the D000 block
DATA_LEN 32 covers D000 through D01F in one transaction
MB_ADDR 1 the address the slave is configured for

The port itself needs nothing register-specific. MB_COMM_LOAD configures the CM 1241 RS485 once at startup for Modbus RTU, and because 16#8188 is raised during input validation, no module setting can clear it or cause it.

Two call-shape faults from the original program also need correcting, because either one keeps a valid parameter set from working. The EN input must already be TRUE when REQ rises from FALSE to TRUE and must stay TRUE through the REQ falling edge; switching EN and REQ together leaves the instruction no steady state in which to detect the request. And the slave is at address 1, so trigger logic that carries 14 addresses a station that is not on the line. Remove any tags marked for automatic conversion until the raw value each input receives is visible; a converted tag can silently put a label value such as 53248 back into DATA_ADDR.

Bench test before you widen the program #

  • Run one slave and nothing else: a minimal program with a single MB_MASTER call and MB_COMM_LOAD executed once at startup.
  • Hold EN TRUE, pulse REQ, and leave EN TRUE until DONE or ERROR reports.
  • Keep MODE 1, the block's first reference, a length of 32 and MB_ADDR 1 exactly as in the table above.
  • Read the receive buffer as raw words and compare two or three of them against the vendor map's values for the matching D registers; matching values prove the offset conversion, not just the absence of an error.
  • Only then add the rest of the machine logic, and only through tags you have watched carry the exact reference values.

The decision for each case #

Reading the D000-to-D01F block: MODE 1, DATA_ADDR at the block's first reference, length 32, MB_ADDR 1, EN steady through the REQ pulse. A map with a different radix or a nonzero base offset moves the answer the same way: reference = 30001 + map offset, with the radix read from the vendor's table and the decimal value of the hex label never used. A 16#8188 that survives those corrections means a MODE or MB_ADDR combination outside the documented set, broadcast misuse or an undefined mode, not a wiring, firmware or port problem.

Questions asked

Can MB_MASTER read holding registers too, and which MODE does that?

Yes. MODE 0 with a 4xxxx reference makes MB_MASTER send function code 03, and MODE 1 with a 3xxxx reference sends function code 04; the MODE value and the address together pick the function code the slave sees. The two inputs must describe the same register type, otherwise the instruction rejects the combination before it transmits.

Why does the decimal value of hexadecimal D000 fail as DATA_ADDR?

Hexadecimal D000 converts to 53248 in decimal, and MB_MASTER validates input register references against 30001 to 39999, so 53248 is rejected. The D labels are the slave vendor's map notation, not Modbus references; enter the first reference of the block instead and let the map offset, not the label value, place it.

Does the CM 1241 RS485 port need a separate setting for input registers?

No. MB_COMM_LOAD configures the port once at startup for Modbus RTU, and no port setting distinguishes input from holding registers. 16#8188 is raised while the instruction validates its inputs, so the fault never reaches the RS485 line, and no module configuration change can clear it or cause it.

How much of the D000 block fits in one request?

The block spans 32 registers and one request reads all of it: a length of 32 beginning at the block's first reference covers D000 through D01F in a single transaction. If you split the block, keep each request contiguous so every reference stays inside the map the vendor published.

Keep reading

  • Troubleshooting

    Why MB_MASTER on an S7-1200 returns an error status but no data

    If the slave answers your PC master but MB_MASTER returns an error STATUS with no data, the PLC never handed the port over or mis-sized the buffer. Run MB_COMM_LOAD once on a first-scan edge, wire its instance DB into every MB_MASTER call through MB_DB, tie both EN inputs to the rail, and size DATA_PTR in bytes while DATA_LEN counts registers.

    PLC programming

  • Troubleshooting

    Why MB_CLIENT reports 16#80A3 on a valid Modbus TCP response

    STATUS 16#80A3 from MB_CLIENT is the block's own connection-level error, not a Modbus exception code, so a capture showing a valid FC03 response moves the whole diagnosis to the instruction side: the local connection identity in TCON_IP_v4, the MB_MODE value for the installed V6.0 block, and the destination buffer. Prove the gateway path with one PC client read, stop that client, then match one PLC transaction field by field.

    PLC programming

  • How-to

    Set up a CLICK Plus as Modbus TCP client to an S7-1200

    Yes: make the S7-1200 the Modbus TCP server with MB_SERVER mapped to a data block of INTs, and make the CLICK Plus the client with Send and Receive instructions aimed at the CPU's IP address and port 502. Write the shared register map first; the S7 logic copies physical inputs into it and applies its output words to the real outputs.

    Industrial networks