Troubleshooting
Why Modbus discrete inputs are off by one at the PLC
Short answer
A Modbus discrete input point 1 travels at protocol offset 0 and reads Do-more MI1, not MI0. When every panel indicator sits one position low, X0 was published into MI0; move the PUBLISH range to MI1 and restore the panel addresses.
On this page
Every indicator on the panel sits exactly one input low, and the cause is in the PLC, not the panel. A Modbus discrete input carries a point number that counts from 1 and a protocol offset that counts from 0, and on a Do-more controller the first discrete input (point 1, offset 0) reads guest memory MI1. You published X0 into MI0, so the element the panel asks for at offset 0 is empty and the element it asks for at offset 1 holds your first input. Move the PUBLISH range to MI1 and put the panel addresses back the way they were; nudging the panel addresses turned the off-by-one into an off-by-two.
Separate a shifted indicator from a dead link #
Work through what you have already observed before touching anything:
- The pushbutton writes its coil through function code 05 and the contact toggles. The link carries a Modbus transaction in both directions, so the transport, roles and endpoint settings are not the fault.
- X0 and MI0 are ON in the data view while the first panel light stays off. The physical input reaches guest memory, but the panel is not looking at that element.
- X1 and MI1 are ON and the first panel light comes on. The panel's first object reads MI1. That is a mapping offset, not a communication failure.
- Changing the panel addresses from 0 to 1, 1 to 2 and so on made the shift two positions. Each edit moved every object further from the data, which confirms the objects themselves were originally consistent.
If instead no reads return data at all, that is a different fault, and the article on Modbus TCP FC02 discrete inputs returning no data covers that case. Here the reads return data; it is just the wrong element.
The four guest memory blocks the server exposes #
A master talking to a Do-more server reaches four dedicated blocks and nothing else: MI, MC, MIR and MHR. The server cannot read physical X and Y points or normal V memory directly, so a request is answered from guest memory even when the ladder has never written to it. Each block corresponds to one Modbus data area:
| Modbus area | Do-more block | Function codes | Modbus access |
|---|---|---|---|
| Discrete inputs | MI | 02 | read only |
| Coils | MC | 01, 05, 15 | read and write |
| Input registers | MIR | 04 | read only |
| Holding registers | MHR | 03, 06, 16 | read and write |
Codes 15 and 16 above are decimal; some panel editors show them as 0F and 10 in hexadecimal, so check which notation your editor displays before entering a function. The panel lights use function code 02, so they land in MI, not in MIR; the names are close and the areas are not. A coil reference in the panel is MC, not the same-numbered C contact in the ladder. Move data between normal memory and the guest blocks with PUBLISH and SUBSCRIBE, or reference the guest addresses directly in your rungs. The same guest-memory pattern is what sits underneath how digital inputs reach a Modbus TCP SCADA read.
Why point 1 lands on MI1 #
Modbus shows an engineer point numbers that count from 1, while the request on the wire carries an offset that counts from 0, so point 1 travels as offset 0. Panel editors may display either convention, which is why the number on the screen alone never identifies the location. In the Do-more discrete-input area, a read at offset N returns the MI element one above that offset, so offset 0 returns MI1. MI0 exists in the controller, but no discrete-input read reaches it. This is why a correct value in the PLC data view can still sit one element below where the panel is actually looking.
Worked example: the first status light on function code 02 #
The inputs, and where each comes from:
- Function code 02, discrete input reads: the light objects as configured on the working Modbus TCP link.
- Light offsets 0 through 15: as assigned in the panel project before any edits.
- PUBLISH X0:SW to MI0:sw, 16 elements: the ladder rung as entered.
- Observations: X0 and MI0 ON with the first light off; X1 and MI1 ON with the first light on.
The rule in words: a discrete-input read at offset N returns the MI element N plus 1, because the discrete-input area begins at MI1.
The arithmetic: the first light reads offset 0, so it returns element 0 + 1 = MI1. The published X0 sits in MI0. The gap is one element. The second light reads offset 1, so it returns 1 + 1 = MI2, which the unchanged publish leaves empty while the first light is already showing X1.
The result: every light at offset N displays input X(N+1). The observed pattern matches exactly, so the publish destination, not the panel, is one element low.
The decision: publish X0:SW to MI1 and keep the 16-element span, so X0 lands in MI1 and X15 lands in MI16. Then offset 0 returns X0 and offset 15 returns X15. The test that proves it: force X0 ON and the panel's first light must come on; force X15 ON and the panel's last light must come on. Until that holds, do not rebuild the rest of the tag list.
Why the panel edit made it off by two #
With the publish still aimed at MI0, changing the first light from offset 0 to offset 1 made it read MI2, and the light for X2 ended up two positions away from the input that belongs there. Each panel edit shifted every object further from the data, because the empty element at the bottom of the MI range never moved. Restore the panel offsets to 0 through 15 and make the correction on the PLC side, where the data actually sits.
The fix, in order #
- Leave the Modbus TCP link and the function code 05 pushbutton alone; both are proven working.
- Record the panel indicator offsets, then restore them to 0 through 15.
- Edit the PUBLISH rung so the destination is MI1 with the same 16-element span, putting X0:SW into MI1.
- Download the project. "Write to PLC" means a project download; offline edits change nothing in the running controller. A download replaces the running program, so do it under your site's change procedure with the machine in a safe state.
- Prove the mapping: force X0 ON and check the first light, then force X15 ON and check the last light.
If the link is Modbus RTU instead of TCP #
The mapping rules above are the same; only the transport setup differs. Open SysConfig, then CPU Configuration, and select Modbus RTU Server in the upper left. Open Change @IntSerial Device Settings..., leave Transmit Control and RTS Control at their defaults for the first attempt, and set the baud rate and parity to match the panel. Download the project before testing; the selected server role is not active in the controller until then. Pick the RTU master driver on the panel side and the station address must match on both ends. When an RTU link reads and writes but indicators never light at all, the article on why HMI indicators stay off over Modbus RTU polling works through that failure; a one-position shift with data flowing is the mapping fault this article covers.
Questions asked
Do I need to change the Transmit Control and RTS Control serial settings?
No. Take the defaults for the initial Modbus RTU server setup, then set the baud rate and parity to match the panel. Those settings matter only on the serial RTU branch; a one-position input shift on a working TCP link is a mapping problem, and serial framing settings cannot fix it.
What does Write to PLC mean?
It means download the project to the controller. Editing the CPU configuration offline leaves the controller running its previous configuration until the download completes, which is why a newly selected Modbus RTU server setting does nothing until you download the project.
What is the difference between MIR and MHR?
MIR holds Modbus input registers, read through function code 04 and read-only through Modbus. MHR holds Modbus holding registers, read and written through function codes 03, 06 and 16. The names are easy to swap; a request aimed at the wrong one lands in a different memory area and returns different data.
Can a Modbus master read the physical X inputs directly?
No. The Do-more Modbus server exposes only MI, MC, MIR and MHR, never the physical X and Y points or normal V memory. Copy data between normal memory and the guest blocks with PUBLISH and SUBSCRIBE, either by referencing the guest addresses directly in the ladder or by moving whole ranges.
Should I ever fix a one-position shift on the panel side?
Not for this fault. The published range defines where the data sits, and the first Modbus input reads MI1, so the PLC-side mapping is the side that sits one element low. Editing panel offsets turns a one-position shift into a two-position shift. Record the panel offsets, restore them, and correct the PUBLISH destination instead.