IMDTouchKnowledge BaseShop main store

Explainer

How an HMI Panel Writes PLC Registers Over RS485

Industrial networks Published 7 min read By IMDTouch engineering team

Short answer

RS485 and RS232 define only how electrical signals travel; they carry no data of their own. An HMI writes PLC registers over that wiring once both devices run the same protocol, usually Modbus RTU, the serial settings match at both ends, and every tag points at the documented register address with the right data type, word order and scaling.

On this page
  1. RS485 carries the signal, not the meaning
  2. What the protocol layer adds
  3. The serial settings that must match
  4. Mapping the tag to the register
  5. Reading a failure by its layer
  6. Worked example: writing a 123.4 °C setpoint to holding register 40011
  7. Prove the link with one test tag
  8. Questions asked

An HMI panel writes PLC registers over RS485 by stacking three layers, and the port itself is the least of them. RS485 and RS232 only move electrical signals between two serial ports; a protocol both devices speak — Modbus RTU in most plants — turns those signals into a request carrying a function code and a register address, and the PLC's register map turns that address into a number the program uses. The compatibility question is never the terminal's serial port; it is whether both endpoints document a common protocol, whether the serial settings match at both ends, and whether every tag points at the right register with the right data type, word order and scaling. This article separates those layers, shows what a write frame carries, reads each failure by its layer, and works one register write end to end.

RS485 carries the signal, not the meaning #

RS232 and RS485 are electrical standards. They define voltage levels and how bytes are signalled on the wire; they say nothing about registers, addresses or writes. RS485 signals a differential pair — the two wires usually labelled A and B — which tolerates the electrical noise of a machine cabinet and lets several devices share one bus in a daisy chain. RS232 is a point-to-point link between exactly two ports. That is the whole difference that matters for a register write.

So the question of whether a given panel can talk to a given PLC is not a port question. Both standards carry any serial protocol, and a write becomes possible only when both endpoints support the same one — Modbus RTU most often, or a vendor serial protocol for which the panel ships a driver. Wire the bus as a daisy chain with short stubs and terminate across A and B at the two physical ends with a resistor matched to the cable's characteristic impedance, commonly 120 ohms. Termination cleans the signal; it does not put data on it.

What the protocol layer adds #

A Modbus RTU frame is short: one byte of slave address, one byte of function code, the data — register address, quantity, values — and a two-byte CRC that catches corrupted frames. A write to a holding register travels as function 16 (0x10), carrying the starting address, the number of registers and the raw values to store; a read back uses function 3, read holding registers. The slave answers with the same address and function, or with an exception code that names the rejection: a function it does not support, an address that does not exist, or a value it refuses.

Two protocol facts decide most write failures. First, a write lands only where the register map allows one: maps mark command words and configuration as read-only, and a write aimed there returns an exception instead of a stored value. Second, the register must exist — an address typed past the end of the map fails the same way. The mirror case, a master write that never reaches an HMI holding register, fails for exactly these reasons on the other endpoint.

The serial settings that must match #

Below the protocol, the two ports must be set identically: baud rate, parity, stop bits, the slave address each device answers to, and which physical port the tag group is bound to — panels with both an RS232 and an RS485 port fail silently when the tags point at the unconnected one. A mismatch shows up as total silence or as frames the CRC keeps rejecting, and silence from a wrong baud rate looks exactly like silence from a wrong slave address or a swapped A and B pair, so check the wiring and the settings together before suspecting the protocol.

Take both ends' settings from the manuals rather than from a machine that happens to work, and record the chosen port, protocol, serial settings and slave address in the machine file so later edits preserve the working combination.

Mapping the tag to the register #

The register map is the contract between the panel tag and the PLC program. Three properties must agree on every tag.

Address. The 4xxxx convention is an offset, not the wire address: holding register 40001 is protocol address 0, so 40011 is address 10. Enter the wire address unless the panel's driver documents that it strips the offset itself; a one-off writes the neighbouring register, which is how a setpoint ends up in a status word. Six-digit codes follow the same offset logic — Decoding Modbus holding register 4500001 from PLC to HMI works an example of that form.

Data type. A 16-bit register is signed or unsigned, and a 32-bit value spans two registers that can arrive with their 16-bit halves in either order. The tag must carry the same type and word order as the PLC's definition: the wrong type mangles values in recognisable patterns, as in Why an HMI Writes the Wrong PLC Value Above 9, and the same word-order and scaling questions decide what a read displays, as in Displaying a PLC Real Value Over Modbus on an HMI.

Scaling. The PLC stores raw counts; engineering units come from a scale factor and offset. Apply the scaling on one side only — in the panel tag or in the PLC program — and record which side, because a value scaled at both ends moves the machine by the wrong amount.

Reading a failure by its layer #

Diagnose downward: electrical silence first, then the mapping, then the application. Each symptom points at one layer:

Symptom Layer to suspect What to verify
No reply at all Physical and serial settings A and B not swapped, termination fitted, correct port selected, baud, parity, stop bits and slave address identical at both ends
Exception reply to a write Protocol permission Register exists in the map, is marked writable, and the function code is one the slave supports
Link healthy, value wrong Register interpretation Address offset, signed versus unsigned, 16-bit word order in a 32-bit pair, scale applied once
Value right until a disconnect Application handling What the machine does with the last value received when the link drops, and how the panel reports a failed write

Change one setting or tag property at a time and repeat the write, so the result tells you which layer moved.

Worked example: writing a 123.4 °C setpoint to holding register 40011 #

The case is the common serial-panel job: the operator enters a setpoint on the HMI and the panel writes it into a PLC holding register over a two-wire RS485 run. The inputs below are an illustrative map — take the real ones from the PLC's register documentation:

  • Register map: setpoint in holding register 40011, 16-bit unsigned, scale 0.1 °C per count, marked writable.
  • Protocol: Modbus RTU on both endpoints, the common protocol each device's documentation lists.
  • Serial settings from both manuals: 9600 baud, 8E1, slave address 5.
  • Operator entry on the panel: 123.4 °C.

The rule in words: convert the engineering value to raw counts by dividing by the scale, write the counts to the register's wire address with function 16 (0x10), then read the register back with function 3 and confirm the counts.

The arithmetic:

  • Wire address: 40011 - 40001 = 10.
  • Counts: 123.4 °C ÷ 0.1 °C per count = 1234 counts. That fits one unsigned 16-bit register (0 to 65535), so no 32-bit pair is needed; in hexadecimal, 1234 is 0x04D2.
  • Frame sent: slave address 5, function 16 (0x10), starting address 10 (0x000A), quantity 1, data 0x04D2, then the CRC.

Result: register 40011 in the PLC holds 1234. A function 3 read back returns 1234, and the panel tag multiplies by 0.1 for display: 1234 × 0.1 = 123.4 °C.

Decision: with the raw register at 1234 and the panel showing 123.4 °C, the mapping is proven, and the remaining operator tags go in the same way. If the register instead reads 12340, a scale of 0.01 was entered somewhere; if the register reads 1234 but the panel displays 1234.0, the panel tag is missing its display scaling; if the write returns an exception, the address or its write permission is wrong, not the electrical layer.

Before any panel writes to a running machine, prove the mapping on one non-critical tag. Pick a spare writable register — a setpoint that idle logic only displays — put the machine in a safe state, write the tag from the panel, and read the raw register at the PLC to confirm the counts arrived at the address you intended. Then write the register's documented minimum and maximum once each and confirm the PLC stores both, and drop the link once mid-operation to watch what the machine does with the last value received and what the panel reports; neither endpoint should treat a stale value as current.

Only after the test tag round-trips at both ends do the remaining tags go in, one at a time, each verified by the same read-back. Never first-test a write on a register that running logic acts on: a one-off address error can move a real output.

Questions asked

Which function code writes a single holding register?

Function code 6 writes one holding register, and function 16 (0x10) writes a block of them, though the block form accepts a quantity of one and many panels use it everywhere. What matters is that the PLC documents the register as accepting the function the panel sends; a device that allows writes on only one of the two rejects the other with an exception reply.

The PLC register holds the right counts but the panel shows a different number. Where is the fault?

The serial link is working; interpretation is not. Read the raw register, then check one thing at a time: the address offset behind the 4xxxx code, signed versus unsigned on a 16-bit tag, the order of the two 16-bit words in a 32-bit pair, and whether scaling is applied on the panel, in the PLC, or twice. Change one item, write again, and read the register back before judging the result.

What serial settings do Modbus RTU devices ship with?

The Modbus serial-line specification defaults to 9600 baud, even parity and one stop bit, and calls for two stop bits when parity is switched off. Real devices are rarely left at that default, so take baud, parity, stop bits and the slave address from each manual and set them identically at the panel and the PLC before the first write.

How should the RS485 segment be wired and terminated?

Run one daisy-chained pair with short stubs, and terminate across A and B at the two physical ends of the segment with a resistor matched to the cable's characteristic impedance. Termination and biasing only make the electrical signal readable; they cannot repair a protocol mismatch, a wrong slave address or a mis-scaled tag, so diagnose electrical silence and wrong values on different layers.

Keep reading

  • Troubleshooting

    Why a PLC Modbus Master Read Returns Nothing From an HMI

    When a PLC Modbus RTU master polls an HMI slave and gets nothing back, three faults hide behind the flashing LED: DTR direction control left at 0 instead of 2, the wrong starting address for LB0, and a one-scan enable that kills the transaction before Done. Fix them in that order.

    Industrial networks

  • Troubleshooting

    HMI Modbus timeout caused by a PLC master-slave conflict

    When an HMI times out on every PLC on its RS-485 network, including units wired directly to it, suspect a master-slave conflict: one PLC port is configured as a Modbus master and transmits against the panel. Make the HMI the only polling master, set every polled PLC port to slave mode with a unique station address, then retest.

    Industrial networks

  • How-to

    How to Send HMI RTC Time to a PCB Over Modbus

    Modbus never broadcasts the panel clock. Configure the HMI as a Modbus client and let it write six holding registers — year, month, day, hour, minute, second — with function code 16 about once per minute, capturing all six values as one snapshot so a rollover never mixes an old date with a new time.

    Industrial networks