IMDTouchKnowledge BaseShop main store

Explainer

What makes an HMI Modbus connection to a small PLC work

HMI and touchscreens Published 9 min read By IMDTouch engineering team

Short answer

An HMI talks to a small PLC over Modbus only when both ends expose the same transport, the HMI works as master and the PLC as slave, the serial framing and slave address match, and the PLC's documented register map covers every value the screen needs. The shared protocol name alone proves nothing; verify each gate before wiring.

On this page
  1. What the Modbus standard settles and what it leaves open
  2. Match the transport and the role first
  3. Serial settings that must match exactly
  4. Ethernet settings that matter instead
  5. The register map and the address conventions
  6. Worked example: one poll of two holding registers at 9600 baud
  7. Reading the first fault: timeout or exception
  8. The decision for each case
  9. Questions asked

An HMI connects to a small PLC over Modbus when three checks pass: both devices expose the same transport with the panel as the polling master and the controller as the answering slave, the serial framing and slave address match the controller's configuration exactly, and the controller's documented register map covers every value the screen reads or writes. The protocol name on the datasheet decides none of that by itself. Modbus defines how a request and a reply are built; it does not give the controller a port, put a driver for that controller into the panel, or settle which register numbers each vendor exposed. Work the three gates in order — transport and roles, link settings, data map — and wire nothing until each one is documented on both sides. If the first read then fails, the fault type tells you which gate you skipped.

What the Modbus standard settles and what it leaves open #

The MODBUS over Serial Line Specification and Implementation Guide V1.02 defines one device — the master, called the client in newer wording — that sends requests, and slaves, called servers, that answer them. On a serial bus only the slaves carry addresses, each one unique on that bus, in the documented range of 1 to 247; the master has no address of its own. The same document fixes the RTU character format and the silent interval that marks the end of a frame.

That is all it settles. It does not give your controller a communication port, it does not put a driver for your controller inside the panel, and it says nothing about which register numbers either vendor chose. Two devices can both carry the word Modbus on the label and still refuse to exchange a single byte: different transports, a driver missing the serial parameters, a data map without the values you need. You will hear that anything speaking Modbus talks to anything else speaking Modbus; that is false at exactly these three points, the same way pairing by brand alone fails, as why an HMI terminal is not compatible with a PLC by brand alone explains.

Match the transport and the role first #

Start on the controller side. Read the controller's exact reference and the reference of any communication accessory fitted to it, then open the documentation for those references. A port used for programming is not automatically a Modbus server: some compact controllers expose Modbus only through an added communication cartridge or slot interface, and a controller fitted with none cannot be polled by any panel at any settings. If the documentation lists no Modbus server function for the installed hardware, no HMI project fixes that — the interface changes first or the architecture does.

Then match the transport. Serial RTU and Modbus TCP share a data model but are different protocols on the wire; an RTU-only port cannot answer an Ethernet-only panel, which is the trap in why Modbus RTU over Ethernet is not Modbus TCP for an HMI. When both transports are fixed and different, the documented answer is a gateway: a transparent gateway forwards each request by its unit ID, while a gateway with a poll list fetches the data itself and re-serves it to the panel.

Then fix the roles. For a polling screen the panel is the master and the controller interface is the slave. If both ends are configured as masters, each waits for the other and the screen times out — the exact failure in an HMI Modbus timeout caused by a PLC master-slave conflict.

Serial settings that must match exactly #

The master and every slave on the line must run the same baud rate; read the value from the controller's port configuration and enter it unchanged in the panel's device settings. RTU characters carry 8 data bits, and the specification pairs the stop bits with parity: one stop bit with parity on (even parity is the documented default) and two with parity off. Panels that offer parity none with a single stop bit anyway do work, for reasons of receiver timing rather than the letter of the specification — why parity none works with one stop bit walks through the arithmetic.

Set the slave address in the controller's configuration and enter that number as the device address in the panel; it must be unique on the bus. Then build the cable from both pinout documents. A connector that fits proves nothing about the signals on it, and swapped RS-485 A and B lines silence the bus completely. None of these faults can be repaired by changing a register number in the project.

Ethernet settings that matter instead #

On Modbus TCP, framing gives way to addressing. Put the panel and the controller interface in one subnet, or route between them deliberately, then point the panel's device entry at the controller's IP address and at the port its server actually listens on. Port 502 is the assigned Modbus TCP port, and a panel left on the default times out against a server moved elsewhere — the case in why a Modbus server on port 8000 causes HMI client read timeouts.

The register map and the address conventions #

The controller documentation lists its Modbus data map: which references exist, their widths, whether each is readable or writable, and which function codes the interface answers. The panel can only ask for what that map exposes; a readable object is not necessarily writable, and a communication object is not necessarily the physical input or output behind it.

Check the convention, not just the number. Documents print a 1-based reference while many drivers expect a zero-based offset, and coils, discrete inputs, holding registers and input registers each carry their own numbering. Prove the convention on one tag whose value you can also watch in the controller's monitoring tool before mapping the rest; the arithmetic that turns a printed reference into the driver's offset entry is worked out in decoding Modbus holding register 4500001 from PLC to HMI. For values wider than one register, check the word order the same way: read a value whose two halves differ, and swap the order in the driver if the controller's display disagrees.

One safety rule belongs here. Enable writes from the screen only with the machine in a state where a wrong command cannot hurt anyone, and treat every write as a request the controller logic validates — the panel never substitutes for an interlock.

Worked example: one poll of two holding registers at 9600 baud #

Inputs. The rate is 9600 bit/s at both ends — a common default on compact controllers and the assumption for this example; every result below scales linearly with the rate you actually run. The specification's RTU format gives 11 bits per character (8 data bits, 1 parity bit, 1 stop bit; the parity-none form with 2 stop bits is also 11). A read of two holding registers is an 8-byte request and a 9-byte reply in the protocol's message layout: address, function, start reference and quantity plus a 2-byte checksum out; address, function, byte count, 4 data bytes and checksum back. RTU frames are delimited by a silent interval of at least 3.5 character times on each side.

Rule. Add the bits of both frames, add the two silent intervals, divide by the bit rate. The result is the least time from the start of one poll to the start of the next, and every refresh period must sit comfortably above it.

Arithmetic. Frames: 8 + 9 = 17 bytes; 17 × 11 = 187 bits; 187 ÷ 9600 bit/s = 19.5 ms. Silence: 2 × 3.5 × 11 = 77 bits; 77 ÷ 9600 bit/s = 8.0 ms. Cycle: 19.5 + 8.0 = 27.5 ms.

Result. The shortest possible poll cycle on this line is 27.5 ms — about 36 cycles per second at most, and a real driver adds its own turnaround delay on top.

Decision. One value refreshed every 250 ms (an illustrative setting) needs 4 cycles per second: 4 × 27.5 ms = 110 ms of line time per second, about 11 percent — comfortable. Ten values refreshed every 100 ms need 100 cycles per second, which at the same cycle time demands 2.75 s of line time per second — the line cannot deliver it. Group instead: one read carries up to 125 holding registers, so ten neighbouring values cost one cycle, not ten. If the controller's port supports it, raising the rate to 19200 bit/s halves the cycle to about 13.8 ms.

Reading the first fault: timeout or exception #

A failed first read sorts into three cases, and each names its gate.

A timeout means no usable reply reached the panel: the request died on the cable, at the framing, at a wrong slave address, or at an interface that is not answering. Check the panel's timeout value against the controller's documented worst-case response time first, then walk the physical and settings layer step by step as fixing an HMI PLC communication timeout over serial sets out. An exception is the opposite and is good news about the wire: the controller received the request, understood it and refused it, so the framing and address are proven and the function code, reference or quantity is what is wrong. A read that succeeds but returns the wrong value takes the link out of the argument entirely; the convention, the word order or the scaling maps the value badly.

What the screen shows What it proves Where to look next
Timeout, no reply Nothing usable arrived Cable and A/B lines, baud, parity, stop bits, slave address, panel timeout against the controller's documented response
Exception reply The request arrived and was understood, then refused Function code, reference number, quantity, write permission
Read succeeds, value wrong The link is sound; the mapping is not Address convention, word order, scaling, signedness

The decision for each case #

  • Controller documentation lists a Modbus server function and the panel's driver list includes the same transport with the panel as master: connect them. That combination works; what remains is settings and mapping.
  • No Modbus-capable interface on the controller: no panel polls it over Modbus at any settings. Fit the documented communication option or change the architecture — do not spend the day on register numbers first.
  • Transports differ and both devices are fixed: put a documented gateway between them; transparent gateways route by unit ID, poll-list gateways fetch and re-serve.
  • Baud, parity, stop bits or slave address disagree: set the panel to the controller's documented values; the specification fixes the duty to match, the controller datasheet fixes the numbers.
  • The value you need is absent from the controller's map: the screen cannot show it over Modbus — map a different reference or change protocol.
  • Timeout: physical layer and settings. Exception: map. Wrong value on a working link: convention and word order.

Run the gates in that order — transport and roles, link settings, data map — and the first read lands on the first attempt.

Questions asked

Can one HMI poll two small PLCs over Modbus at the same time?

Yes, if the HMI driver supports multiple devices and each controller runs as a slave with a unique address. On one serial line, give every controller a different slave address and its own device entry in the HMI project. Over Ethernet, each controller is a separate server reached by its own IP address and port. One read can only come from one device, so a screen value can mix sources only through the controller logic or a gateway.

Do I need the PLC vendor's programming software to connect an HMI over Modbus?

No. Modbus is an open protocol, so any HMI with a documented Modbus RTU or TCP driver can exchange data with a controller that runs the matching server function. What you need from the PLC documentation is the port's electrical interface, its serial framing, the configured slave address or IP settings, and the complete register map. You still need the vendor's software to set those settings on the controller and to build its logic.

What Modbus exception codes does a small PLC usually return to an HMI?

The three you meet most often are 01, illegal function, when the controller does not implement the function code the HMI sent; 02, illegal data address, when the requested reference is not in the controller's map; and 03, illegal data value, when a quantity or value in the request is out of range. The reply carries the requested function code plus 128, so a refused read of holding registers comes back as function 131.

How fast can an HMI refresh values over Modbus RTU?

Set the expectation from the serial line, not from the software. One request-and-reply cycle for two holding registers at 9600 baud with even parity takes at least 27.5 ms including both silent intervals, so the line carries roughly 36 cycles per second at most. Larger blocks raise the bytes per cycle but share one header, so reading 10 registers in one transaction beats 10 separate reads. Give each tag the slowest refresh the operation tolerates.

Keep reading

  • Selection guide

    Connecting a Do-more PLC to a Third-Party HMI

    A Do-more CPU reaches any third-party HMI over Modbus: the H2-DM1E serves Modbus/TCP on its Ethernet port — up to 8 simultaneous masters — and Modbus/RTU on its RS-232 port, while the non-E H2-DM1 serves Modbus/RTU only. C-more is the single panel line with a native Do-more driver, so every other panel or PC runtime binds to a Modbus register map you build and control.

    HMI and touchscreens

  • Troubleshooting

    Connecting a Delta DVP 15MC PLC to a Weintek HMI

    The DVP 15MC exposes its data to an HMI as a Modbus TCP server on the standard port 502. In EasyBuilder Pro, use a 15MC-specific driver if your editor's driver list has one, otherwise the generic Modbus TCP driver with the controller's register-to-Modbus mapping table. A 64-bit QWORD spans four holding registers, so prove one read-only tag before building screens.

    HMI and touchscreens

  • How-to

    Connecting an XBTGT HMI to an M241 PLC over Modbus TCP

    Delete the Generic Modbus TCP slave from the M241 device tree and activate the Modbus server on the controller's Ethernet interface instead — that slave makes the M241 a client, so both devices poll and neither answers. Then map Vijeo Designer driver address 40001 to PLC word %MW0, keep TCP port 502 open between panel and controller, and shift the address map by one word if a test read lands one register off.

    HMI and touchscreens

Why a WinCC named connection fails when TCP/IP tags work