IMDHMIControls LibraryShop main store

Explainer

Why S7-1500 Modbus RTU input registers come from the IW area

Industrial networks Published 6 min read

Short answer

On an S7-1500 Modbus RTU slave, input registers read with FC 04 are served from the CPU's process image of inputs, the IW area; the DB pointer on the slave call routes only holding registers. An analog module mapped at IW0 therefore answers input-register requests with live process values that belong to nothing in your register map. Correct the master's function code or move the module's I addresses out of the requested range.

On this page
  1. Where each Modbus register type lives in the CPU
  2. The function code selects the data path
  3. Why an analog module at IW0 returns wrong data
  4. Working the case: input register 30001 with the analog module mapped at IW0
  5. Freeing the requested IW range
  6. Proving the map
  7. Questions asked

On an S7-1500 configured as a Modbus RTU slave, input registers read with FC 04 are served from the CPU's process image of inputs, the IW area. There is no DB pointer for them because the slave instruction never routes input registers through a data block: the pointer parameter on the slave call applies to holding registers only. That is why the parameter list looks incomplete once holding registers work. The practical consequence is a specific trap: an analog module mapped at the low IW addresses will answer FC 04 requests with live process values that belong to nothing in your register map, and the numbers look perfectly plausible. The fix is one of two moves, and the master's function code decides which.

Where each Modbus register type lives in the CPU #

The Modbus specification defines a holding register as a 16-bit read/write word and an input register as a 16-bit read-only word. On the S7-1500 slave the two types take different routes through the CPU:

Register type Master function code CPU area Configured by
Holding register FC 03 read, FC 06 or FC 16 write The DB or memory area the pointer names Pointer parameter on the slave FB call
Input register FC 04 read Process image of inputs, IW The I/O addresses in the hardware configuration

Whatever word an FC 04 address lands on in the input image is what the master receives. If a module occupies that word, the master gets the module's live value; if nothing does, the master gets an unused word. Confirm the exact Modbus-number-to-IW offset in the help of the slave instruction for your TIA Portal version rather than deriving it from the holding-register convention. Other platforms split the same question differently: what CODESYS %IW0 means for a Modbus TCP holding register (article:what-codesys-iw0-means-for-a-modbus-tcp-holding-register) is the mirror-image case, and reading Modbus RTU writes into a CJ1W-SCU31-V1 slave area (article:reading-modbus-rtu-writes-into-a-cj1w-scu31-v1-slave-area) shows a serial module that maps its slave data into a data-memory area instead of the process image.

The function code selects the data path #

The function code byte in the master's request decides which of the two paths the slave uses:

  • FC 03 reads holding registers, so the reply comes from the DB the pointer names. A request for "input" data sent with FC 03 returns holding content and never touches the input image.
  • FC 04 reads input registers, so the reply comes from the IW words of the hardware configuration.

A link that already passes holding registers has proven the serial parameters, the wiring and the slave address, but nothing about the input-register path. When the input-register request misbehaves, the two causes that cover nearly every case are a wrong function code and hardware I/O occupying the IW words the master requests.

Why an analog module at IW0 returns wrong data #

Analog input modules commonly receive low I addresses in the device configuration, so their words sit at the bottom of the input image. An FC 04 request aimed at the first input registers therefore lands directly on those modules, and the master receives valid raw values that track real field signals, which is exactly why the fault is easy to miss. Meanwhile the data you actually wanted to publish is not in the input image at all: the CPU refreshes the input image from the I/O modules on every scan, so program logic cannot hold a value there for the master to read.

Working the case: input register 30001 with the analog module mapped at IW0 #

This is the case that reached us: holding registers pass, FC 04 returns data, but the data is not what was meant to be published, and the analog modules sit at the bottom of the IW area.

Inputs. The master sends FC 04 for the first input register, 30001, quantity 2. The analog module's I addresses begin at IW0, so its words occupy IW0 upward.

Rule. In this convention input register 30001 resolves to the first word of the input image, each further register takes the next word, and the quantity must stay within the documented input-register range of 1 to 125 for the S7-1500 slave. The mapping is confirmed in the slave instruction's help, and a watch table proves it on your CPU.

Arithmetic. Register offset: 30001 minus 30001 equals 0, so the first requested word is IW0. The second register is IW0 plus 1, which is IW1. Quantity check: 2 is less than 125, so the range is inside what the slave serves.

Result. The slave answers with a normal reply, no exception, and both words carry the analog module's live raw values.

Decision. If those two words are the signals you meant to publish, the map is finished: record register 30001 as the module's first channel word and scale on the master. If any word in the requested range belongs to a module you did not intend to publish, move that module's start address above the requested range before the map goes into service.

Freeing the requested IW range #

When the requested range overlaps modules that should not be published, resolve it in the hardware configuration:

  • List every input module and its first and last IW word in the device view.
  • Write the map: Modbus register, IW address, source signal, scaling.
  • Change the start addresses of the unrelated modules so they sit above the range the master reads, and keep every module inside the CPU's process image input size shown in the CPU properties.
  • Compile and download the hardware configuration. A hardware download stops the CPU, so schedule it with the machine stopped.
  • Update every PLC tag, HMI address and program reference that used the moved modules' old absolute addresses, and recompile until no address errors remain.
  • Leave the FC 03 holding-register mapping untouched; its DB pointer is independent of the I addresses you moved.

Proving the map #

Verify in this order, one request at a time:

  1. Send FC 04 for the first register of the map. Expected: a normal reply with no exception bit set in the function code byte.
  2. Apply a known signal to the mapped input. Expected: the register follows it and matches the same IW word in a watch table.
  3. Read a register in the range you vacated. Expected: it no longer follows the moved module's signal.
  4. Read the FC 03 holding registers and write one with FC 06. Expected: the DB content behaves exactly as before the address change.
  5. Poll the full FC 04 range over several minutes with the machine running. Expected: every register tracks its own source signal and none carries a value that belongs to an unrelated module.

Questions asked

Can program logic publish a computed value as an input register?

No. The CPU overwrites the process image of inputs from the I/O modules on every scan, so a value your code writes into an IW word is replaced before the master reliably sees it. Write the computed value into the DB named by the slave call's pointer parameter and let the master read it as a holding register with FC 03; that is the standard route for program-generated data.

Do process image partitions change how the slave addresses input registers?

No. Process image partitions only change which organization block updates a given set of inputs during the scan. The Modbus slave instruction still resolves an FC 04 request against the IW addresses of the hardware configuration, so editing partitions does not move, extend or redirect the input-register map.

What is the largest FC 04 request an S7-1500 slave accepts?

The S7-1500 point-to-point documentation supports input registers 1 to 125, and the Modbus specification describes FC 04 as reading up to about 125 contiguous registers per request. A request for more registers, or one whose range runs past the CPU's process image input size, is answered with exception code 02, illegal data address. Split larger reads into several requests.

Why do the values look valid when the master reads input data with FC 03?

Because the FC 03 request never touches the input image. It returns holding-register content from the DB the slave call points to, so the master receives well-formed, sensible-looking words that simply come from the wrong area. If the numbers respond to writes but never track the field signal you expected, check the master's request type first; input registers need FC 04.

Keep reading

  • Troubleshooting

    Reading Modbus RTU writes into a CJ1W-SCU31-V1 slave area

    The CJ1W-SCU31-V1, configured as a Modbus RTU slave, stores each master write in its allocated slave data area by itself, so there is no ladder receive instruction to add. If the area starts at D0, holding register 40001 maps to D0 and 40010 to D9, and the CJ2M ladder reads those D words directly. Fix the Micro850 MSG_MODBUS errorID 21 local channel configuration error before testing any data.

    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

  • Troubleshooting

    Why an S7-200 gets no Modbus reply from a PowerFlex 4M

    Silence from a PowerFlex 4M is a wiring or settings fault until a second Modbus master proves otherwise. Test the drive with a known-good Modbus RTU master first: no reply means the physical link or the drive's settings; an exception reply means the drive is talking and the request is wrong; a valid reply with wrong data is a register-offset error. Only then copy the proven settings into the Modbus/USS master on the CPU 224.

    Industrial networks