Troubleshooting
Why your Modbus poll uses two slave addresses with one PLC
Short answer
Keep the slave address configured in the PLC's serial channel, 1 on this machine, and delete the second acquisition call: a Modbus slave address identifies one device on the bus, and the poll to address 2 is a leftover from a removed second PLC. A Read Input Registers start of 500 is a zero-based protocol offset, reference 30501, so the block never sits at %MW30500; where it lands in %MW terms is fixed by the communication card's register map and proven with one read of a known value.

On this page
Configure the PLC's serial channel for slave address 1 and delete the acquisition call that polls address 2. One PLC on the bus is one Modbus slave; the second call is a leftover from the two-PLC system this application was built for, whose hardware was removed before its software was finished. A request's address byte selects the device that answers, never a memory area inside a device. The rest of the inherited block is sound: the Read Input Registers call asks for a block of input registers at start 500, where 500 is a zero-based protocol offset — documentation reference 30501 — so neither %MW500 nor %MW30500 follows from the number by itself.
A slave address selects a device, not a memory area #
An RTU frame opens with one address byte. Valid station addresses run 1 to 247, each used by exactly one device on the pair, and 248 to 255 are reserved. A slave processes only telegrams that carry its own address. Address 0 is broadcast: slaves execute writes sent to it and reply with nothing, so a read aimed at 0 can only end in a timeout — the failure behind why Modbus RTU sends to slave address 0 instead of your device.
So two calls addressed to 1 and 2 are two destinations. In the old system a second PLC sat on the same RS-485 pair and answered address 2; when it was removed, its poll stayed behind. Nothing else on the bus can take over that number:
- The PC and its serial port are the master side and hold no slave address.
- The RS-232-to-RS-485 converter has no Modbus address.
- The communication card in the PLC rack hosts the Modbus server, and the channel address configured in that card is the PLC's address — read it there, and on this machine set it to 1.
The decision for one PLC: address 1 at the channel, one acquisition call, the call to 2 deleted. If a second PLC genuinely sits on the pair, both calls stay, with 1 and 2 configured in the two devices respectively.
How to delete the second poll cleanly #
A stale poll is not neutral: every cycle it transmits a request nobody answers, then holds the port until the response timeout expires, so the application reports a communication fault about one timeout late, every scan. Remove it together with its dependents:
- Keep a copy of the working application before editing; the program is inherited and small edits travel far.
- Leave one serial initialization and one request sequence; requests to different slaves share one port and must run strictly one after another.
- Delete the call to address 2 with everything that consumed its reply: indicators, array writes, error branches and the scheduling that waits on it.
- Poll one register from slave 1 and compare the value with the PLC's online display.
- Confirm no other device on the pair uses address 1; two slaves sharing an address answer at once and their colliding replies fail the CRC check.
The deleted call only reads, function 04, so removing it cannot command the machine; still, make the edit offline and keep the previous version so monitoring can be restored if the edit goes wrong.
Start 500 is a protocol offset, reference 30501 #
Function 04 puts a 16-bit start offset and a 16-bit quantity into the request; the wire carries the offset, not a 3xxxx number. The leading 3 in the documentation notation names the input-register table, and the count begins at 30001 for offset zero, so reference = 30001 + offset. The block this application asks for:
| Item | Value |
|---|---|
| Start offset in the frame | 500 |
| Reference of the first register | 30001 + 500 = 30501 |
| Quantity | 45 registers |
| Last offset covered | 500 + 45 - 1 = 544 |
| Reference of the last register | 30001 + 544 = 30545 |
The same one-step gap between notation and wire value is why Modbus error 8189 needs 400001 added to the register address on an S7-1200. Whether a word answers function 03 or function 04 at all is the server's choice, the question behind Modbus holding register vs input register: which one to use.
Why the block is never at %MW30500 #
The 3 is a table code, not a digit of a word number, so gluing the notation onto %MW is the one reading to reject outright. %MW names belong to the controller's programming model; Modbus references belong to the communication card's server, and the card's register map is the only bridge between the two. Decide by what that map exposes:
- Input registers mapped one-to-one onto the word area: offset 500 is %MW500 and the block runs to %MW544; move nothing.
- Words served through holding registers only: a server that does not implement function 04 rejects it with exception code 1, so switch the call to function 03 at the same offset and leave the data where it is.
- Either way, prove the translation once: put a known value in the candidate word, read that single offset, and accept the map only when the reply shows the value.
What the stale poll costs on the wire #
Worked example, with example settings of 9600 bit/s, 8 data bits, even parity and one stop bit — 11 bits per RTU character — and a 1000 ms response timeout:
- Request to the real slave: 8 bytes × 11 bits = 88 bits; 88 / 9600 = 9 ms.
- Reply with 45 registers: 1 address + 1 function + 1 byte count + 2 × 45 = 90 data bytes + 2 CRC = 95 bytes; 95 × 11 = 1045 bits; 1045 / 9600 = 109 ms.
- Two silent gaps of 3.5 characters, about 4 ms each: round trip 9 + 109 + 8 = 126 ms, about 0.13 s.
- The dead poll to the missing slave: 9 ms of request, then silence until the 1000 ms timeout — about 1.01 s per cycle for nothing.
With the dead poll deleted, the cycle drops from roughly 1.14 s to 0.13 s at these settings, and the timeout stays sized for the real slave. The same per-request arithmetic is why Modbus RTU drive polling on one serial port is slow when blocks and slaves multiply. Decision for this machine: channel address 1, one call reading 45 registers at offset 500, and everything aimed at address 2 gone.
Questions asked
Can the RS-232-to-RS-485 converter be the slave at address 2?
No. A converter only changes signal levels and transmit direction between the PC port and the RS-485 pair; it holds no Modbus address and never answers a request. Silence on the poll to address 2 means no device is there, not that the converter took the address. Its wiring still matters for slave 1: match pair polarity at both ends and connect the signal reference, or the real slave goes quiet as well.
How many registers can one Read Input Registers request return?
The protocol allows a quantity of 1 to 125 registers in a single function 04 request, so this application's block sits well inside the limit. A request above 125 is refused with exception code 3, illegal data value. Splitting a larger data set into several requests costs one full request-and-reply turnaround each, which is why block size and poll count are tuned together.
Is the serial slave address the same as the unit ID in Modbus TCP?
They serve the same purpose under different rules. On a serial pair the station address runs 1 to 247 and every device needs its own. In a Modbus TCP request the unit identifier is a single byte, 0 to 255, and for a direct connection to one server it is often a fixed value; it matters mostly when a gateway forwards to serial slaves, because the gateway copies it into the address byte of the RTU frame.
Could I keep the second call and point it at slave 1 as well?
It would run, but it doubles the traffic for data the first call already brings in, and it adds a second reply that must be matched to the right call. Two calls on one serial port must be strictly serialized; if the second transmits before the first reply has finished, it can consume that reply and land the block in the wrong array. Deleting the call removes both risks and the per-cycle timeout.
Is shortening the response timeout enough for the missing slave?
No. A shorter timeout shrinks the wait, but the dead poll still occupies the port every cycle and still drives the error handling attached to it. Size the timeout for the real slave instead: with the bit rate in the worked example the good poll needs about 0.13 s, so a few hundred milliseconds covers it with margin. Then delete the poll that has no device to answer.

