IMDHMIControls LibraryShop main store

Troubleshooting

Why Modbus error 8189 needs 400001 added to the register address

Industrial networks Published 6 min read

Short answer

Status 16#8189 from MB_MASTER on an S7-1200 is an invalid data address, not a wiring fault. When the slave's manual documents a zero-based holding-register offset, add the holding-register base to it: offset 20200 is entered as DATA_ADDR 420201, and the block transmits function code 3 to the intended register. The accepted address ranges, the arithmetic and the checks for a stubborn 8189 follow.

On this page
  1. What 16#8189 is telling you
  2. Two notations for one register
  3. The address table the block works from
  4. Converting offset 20200 into DATA_ADDR 420201
  5. A clean first test
  6. What to check when 8189 stays
  7. Questions asked

Status 16#8189 from MB_MASTER on an S7-1200 is an invalid data address, and the usual cause is a notation mismatch rather than the wire. Your slave's manual documents the parameter as a zero-based holding-register offset — 20200 in the case worked below — while the block expects the six-digit application reference. Enter 420201 at DATA_ADDR and the read completes. The address table the block works from, the conversion with the arithmetic shown, and the checks for an 8189 that survives the conversion follow.

What 16#8189 is telling you #

The instruction help lists 16#8189 as invalid data address value: an error in the data address, or an address outside the area the block can serve. The documented remedy is to select a suitable value at the DATA_ADDR input and to confirm the partner actually implements that address, which tells you the code fires in one of two places. Either the block's own check refuses the value, because it is not inside a range the block maps to a Modbus function, and nothing is transmitted; or the request goes out and the slave answers with exception 02, illegal data address, because that register is not implemented on the device.

You separate the two with one change: fix the address and touch nothing else. If the status clears, the block's check was the obstacle. The neighbouring code 16#8188 points at the register area you selected rather than the offset; that case is covered in why MB_MASTER on an S7-1200 reports Modbus error 16#8188. And 16#818A, invalid length, is the DATA_LEN, not the address.

Two notations for one register #

A Modbus request carries a 16-bit register address counted from zero, so the protocol itself can name offsets 0 to 65535. That is the number most device manuals print, because the table is meant for any Modbus master. The six-digit reference is the application-layer convention: the leading digit names the area — 4 for holding registers, 3 for input registers — and the remaining digits count registers from one, so reference 400001 is offset 0.

MB_MASTER works in that convention. It reads the area from the leading digits and derives the function code from the area: a read of a 4-area reference goes out as function code 3, a read of a 3-area reference as function code 4. A bare offset carries no area the block can use for a holding-register read — that is the whole fault.

The address table the block works from #

The Modbus addresses table in the MB_MASTER instruction help — the table the TIA Portal V13 SP2 help shows in this case — maps each DATA_ADDR range to an area and a function code. The two register rows:

Area Function code on a read DATA_ADDR range the block accepts Offset put on the wire
Holding registers 3 400001 to 465535 DATA_ADDR − 400001
Input registers 4 300001 to 365535 DATA_ADDR − 300001

Coils and discrete inputs have their own rows with their own leading digits. The row's top minus its base is 65534: the last offset this instruction can reach, one below the protocol's 65535. Anything typed outside the rows is what the help means by an address it cannot access.

Converting offset 20200 into DATA_ADDR 420201 #

The inputs, each with its source:

  • Device manual, register table: the parameter sits at holding-register offset 20200 and is read with function code 3; the table counts registers from zero. Source: the register table of the installation this example is taken from.
  • Controller side: MB_MASTER on the S7-1200's RS485 module, project in TIA Portal V13 SP2, STATUS 16#8189 with the bare offset at DATA_ADDR. Source: the same installation.
  • Accepted references and the wire offset: the holding-register row of the help's Modbus addresses table above. Source: the MB_MASTER instruction help.

The rule in words: MB_MASTER wants the application reference, so add the area base — the reference that corresponds to offset 0 — to the manual's zero-based offset. The block subtracts that base again and places the manual's number into the request.

The arithmetic:

DATA_ADDR = 400001 + 20200 = 420201

Wire check: 420201 − 400001 = 20200, exactly the offset the manual documents, so the request leaves for the register you want.

The result: enter 420201 at DATA_ADDR, with MODE at 0 and DATA_LEN at the registers the parameter needs. In the installation this example comes from, that one change turned STATUS 16#8189 into a completed read, with slave address, baud rate and wiring untouched.

The decision: for every zero-based holding-register offset in that manual, add the base — the converted reference lands inside the accepted row for any offset up to 65534. A table that already prints six-digit references is typed unchanged; adding the base again pushes the request to the wrong register or out of the row. Past the row's top, the instruction cannot reach the register at all.

A clean first test #

Change the address and nothing else: keep the slave address, baud rate, parity and wiring as they were, so one variable moves. Set MODE to 0 for the read, DATA_LEN to the registers the parameter occupies — two for a 32-bit value — and point DATA_PTR at a buffer with room for two bytes per register. Function code 3 carries at most 125 registers per request, so a long parameter block needs several requests.

Watch the block's outputs, not the process value. A failed transaction leaves the previous contents sitting in the buffer, so gate any logic that consumes the data on ERROR being false with a fresh DONE — otherwise a dead device reads like a live one.

If the status becomes 16#80C8 instead, the addressing question is answered: the request now goes out and nothing comes back. That path is worked in why an S7-1200 MB master gets status 80C8 with no reply, and a swapped A/B pair is the classic silent cause, covered in why a CM1241 RS485 A/B polarity stops Modbus RTU slave replies.

What to check when 8189 stays #

An 8189 that survives the conversion points at the document or the device, not the block. Work down the list:

  • The table already prints six-digit references. Type them unchanged; adding the base again moves the request to the wrong register or out of the row.
  • The register is an input register, not a holding register. The 3-area row and its base apply, and the read goes out as function 4. Treating one area as the other is the mistake behind the sibling 8188 code.
  • The manual counts from one. The wire offset is one below the printed number, so add the base to the printed value minus one.
  • DATA_LEN runs past the end of the device's map. A read is accepted or rejected as a whole; if the last register in the span does not exist, the slave refuses the entire request. Shorten the read.
  • The register is not implemented. Read something the device certainly has — identification data or a basic measurement. If that returns data while the parameter keeps failing with a converted address inside the accepted row, the parameter is absent on this model or firmware, and no address will find it.

Questions asked

Does the same address conversion apply to a write with function 6 or 16?

Yes. Writes to holding registers use the same holding-register row of the address table, so the converted reference stays and only MODE changes to 1. Function 6 writes one register and function 16 writes several, with DATA_LEN and the DATA_PTR buffer setting the amount. Coils are different: they sit in their own row with their own leading digit, so a coil write needs that row's range, not the register base.

My manual prints five-digit references such as 40102. What do I enter?

Pad the register number to five digits behind the area digit: 40102 becomes 400102, and an input register printed as 30105 becomes 300105. The block accepts only the six-digit form, and a five-digit number sits below the holding-register row of its table, so it reports an address error even though the manual's number is correct.

A Modbus poll from a PC reads the register, so why does the PLC reject the same number?

A PC master or SCADA driver usually takes the manual's zero-based offset and copies it into the request's address field, which is exactly what the wire format wants. MB_MASTER instead derives the area and function from the leading digits of a six-digit reference and refuses a bare offset. Both tools transmit the same address in the end; only the notation each expects differs.

Can a wiring fault produce 16#8189?

No. A broken or swapped A/B pair, missing termination or a wrong baud rate produces time-outs such as 16#80C8 or framing errors, because no valid reply arrives at all. 16#8189 is an address verdict, delivered either by the block's own check or by the slave's exception 02. Fix the address first and let the status tell you when the transport becomes the problem.

The read completes now, but the value is wrong. Is the address still the problem?

No. A completed read proves the transaction, not the decode. Check that DATA_LEN covers the whole parameter, then the word order for two-register values, then signedness and scaling, comparing against the device's own display. Power and energy parameters are commonly 32-bit quantities whose word order the register table specifies; use the order the table gives, not the order another device used.

Keep reading

  • Troubleshooting

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

    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.

    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

  • Troubleshooting

    Why an S7-1200 MB master gets status 80C8 with no reply

    80C8 is a slave timeout: the MB_MASTER call transmitted and accepted no response frame before the timeout expired. With a slave proven good by a laptop test tool, work the order A/B swap, slave ID, MB_COMM_LOAD on First Scan, then bus capture; the 400xx leading-zero entry is an address convention, not the fault.

    Industrial networks