IMDTouchKnowledge BaseShop main store

Troubleshooting

Why PLC Modbus reads from an HMI stop after five minutes

HMI and touchscreens Published 6 min read By IMDTouch engineering team

Short answer

A one-directional failure means the link and the write path are healthy and the PLC's read transaction is at fault. Count read attempts separately from read successes, test single 16-bit words at zero-based offsets 0, 1 and 2, then restore the float pairs one range at a time until the frozen branch shows itself.

On this page
  1. What a one-directional stop proves
  2. Add four counters and one timestamp to the PLC program
  3. Check the addressing before blaming the network
  4. Counting reads over a 10-minute window on a 1-second cycle
  5. Prove the map one word at a time
  6. Isolate the network after the transactions check out
  7. Rebuild the read task so one failure cannot stop it
  8. Questions asked

When a PLC keeps writing to an HMI but its reads from the panel freeze after about five minutes, the Ethernet link is not your problem. A Modbus read and a Modbus write are independent request-and-reply transactions, so a master can keep one branch running while the other stalls. The fault sits in the PLC's read task or in its register addressing. Count read attempts separately from read successes, prove the map with single words at offsets 0, 1 and 2 using one addressing convention, then restore the float pairs one range at a time.

What a one-directional stop proves #

Continuing trends and correct local displays on the panel prove three things: the HMI runtime is alive, its local tag bindings work, and the PLC-to-HMI write path is healthy. They prove nothing about the read transaction. The PLC holding its last received values, rather than showing zeros or comm-error flags, tells you the connection itself stayed up while the read branch died inside the master.

That is exactly the failure pattern to expect, because each read and each write is its own transaction. A master can keep issuing writes while its read branch stops being called, requests the wrong range, times out on every cycle, or sits in an uncleared error state from an earlier failure. Panel activity therefore never clears the PLC side; only the read counters and the raw requests do.

Add four counters and one timestamp to the PLC program #

Instrument the communication task before changing anything:

  • An attempted-read counter, incremented every time the read request is issued.
  • A successful-read counter, incremented only when a valid reply is actually decoded.
  • Attempted-write and successful-write counters, so the healthy direction is measured, not assumed.
  • A freshness timestamp updated only on a successful read decode, so stale data can be flagged on the display.

The decision rule is simple. If the write counters keep climbing while the read-attempt counter freezes, your sequencing stopped calling the read branch. If read attempts keep climbing while read successes freeze, the request leaves the PLC but no valid reply comes back, which points at the request contents or the panel's server side, not at your task scheduling.

Check the addressing before blaming the network #

Register notation is the most common silent fault here. Some drivers display register numbers while controller logic expects zero-based offsets, and a one-register displacement leaves the panel's local tag display correct while the PLC reads the neighbouring word. Pick one convention, write it on the register map, and never mix a displayed register number with a protocol offset. The pattern behind many of these mismatches is covered step by step in /articles/fixing-modbus-tcp-addressing-errors-between-an-hmi-and-a-plc/.

Then check the data shapes. Each 32-bit float occupies two consecutive 16-bit registers, and the word order and byte order must agree on both sides; a mismatch reads plausible but wrong numbers, the same failure mode described for PLC-5 float reads in Why PLC-5 float reads fail while integer reads work. Packed bits travel as one ordinary register: read the whole word, then apply the two bit masks only after a successful decode. Keep every range non-overlapping, and check that no periodic panel object, macro or recipe write lands on the same LW words your PLC reads.

Counting reads over a 10-minute window on a 1-second cycle #

This worked example isolates the fault with counters alone.

Inputs. The reported symptom is reads that stop after roughly five minutes of running. The example test cycle is one read each second, chosen deliberately fast so the window catches the fault. The observation window is 10 minutes, twice the failure time, and the request is one 16-bit word at zero-based offset 0 with quantity 1, because the first test belongs at the very first register.

The rule. Expected attempts equal the cycle rate multiplied by the window. If the task runs the whole window, the attempt counter must reach the full expected count; the success counter tells you where the replies stopped.

The arithmetic. One read each second over 600 s gives 600 expected attempts. A success counter stuck at 300 means about 300 s of good traffic, which is five minutes of correct replies before they stopped, matching the reported failure time almost exactly.

The decisions.

  • Attempts at 600 with successes frozen at 300: the PLC called the read branch for the whole window, so requests kept leaving after the replies stopped. The fault is in the request contents or the panel's server: verify the unit ID, the offset, the quantity, the exposed LW range and the reconnect handling.
  • Attempts frozen near 300 while write counters climb: the PLC stopped issuing reads at the failure point. Inspect the read routine's enable condition, busy flag, timeout status and error result online at the failure moment.

Run this on a bench or with the machine in a safe stopped state, because editing the PLC communication task while the line runs can interrupt outputs.

Prove the map one word at a time #

  1. Enter a known value into the panel's LW-0, read offset 0 with quantity 1, and compare raw words, never the formatted display.
  2. Repeat the single-word test at offsets 1 and 2 until three independent words transfer cleanly.
  3. Restore each float pair and the packed bit register one range at a time, decoding a float only after its transaction succeeds.
  4. If a restored float reads plausible but wrong, inspect the raw word pair for swapped order before touching anything else.
  5. Write the map down: panel LW location, external Modbus offset, word count, data type, word order and PLC destination for every item.

When the single words hold but a restored range still fails, the range itself carries the defect, usually overlap, word order or a second writer on the same words.

Isolate the network after the transactions check out #

A panel, controller and engineering PC sharing one hub is a legitimate suspect for congestion, duplicate addresses and link transitions, so for the diagnostic put the controller and panel alone on a small switch or a dedicated segment and remove the PC. A similar freeze appears when two masters poll the same slave, as explained in /articles/hmi-modbus-timeout-caused-by-a-plc-master-slave-conflict/. Isolation removes network noise, but it cannot repair a wrong offset or a read task that stopped being called, so do it after the counters and single-word tests have had their say.

Rebuild the read task so one failure cannot stop it #

Give the PLC communication logic separate states for idle, request pending, successful decode, timeout, protocol exception and reconnect, and clear a failed transaction the way your communication library documents rather than letting a busy or error flag block every later read. Drive the display from the freshness timestamp: when the read-success indicator stops changing, mark the shown values stale instead of presenting the last decoded numbers as live data.

The final decision tree: successes frozen while attempts continue means fix the request or the panel's server side; attempts frozen means fix your own state machine; both clean on single words means isolate the network and retest.

Questions asked

Why do the panel's trends keep drawing while the PLC receives nothing new?

Reads and writes are independent Modbus transactions. The trends prove the write path and the panel's local tag bindings; they say nothing about the read transaction. The controller holding its last received values means the read branch stalled while the connection itself stayed up, so the fix is on the read side, not the cable.

How do I tell a stalled PLC task from a rejected request?

Count attempted reads and successful reads separately. If attempts keep counting while successes freeze, the request leaves but no valid reply comes back, so the offset, unit ID, quantity or the panel's server is at fault. If attempts freeze while the write counters keep climbing, the PLC stopped calling the read branch, so the fault is in your own sequencing.

How many registers does one float value need on the Modbus map?

A 32-bit float occupies two consecutive 16-bit registers, and the word order and byte order must match on both sides. Judge the raw words, not the formatted display, when a restored value looks plausible but wrong, and correct the order only after the single-word tests at the first offsets pass.

Should the panel and PLC share a network with the engineering PC?

For the diagnostic, remove the PC and put the controller and panel on a small switch or a dedicated segment, then check for duplicate IP addresses and link transitions. A shared hub adds congestion and link noise, but isolating the network cannot fix a wrong offset or a read task that stopped being called.

Keep reading

  • Troubleshooting

    Writing WAGO 750 PLC Digital Outputs From a Weintek HMI

    Your read at 0x 513 is already the right address: in the panel's 0x notation it is decimal bit 512, %QX0.0, inside the WAGO physical output area 512–767 (0x0200–0x02FF). The write fails because the CODESYS program assigns %QX0.0 every scan and overwrites it, so command an internal memory bit and let the logic drive the output.

    HMI and touchscreens

  • Troubleshooting

    Fixing Modbus TCP Addressing Errors Between an HMI and a PLC

    An HMI 'device not found' alarm over Modbus TCP usually means the panel sent a request outside the PLC's mapped registers, not that the network is down. Convert the PLC's byte offsets to register addresses with HMI address = 40000 + byte offset / 2, so a REAL at 100.32 becomes 40016 and 100.36 becomes 40018, and allocate booleans from 100.16 so the driver's grouped 16-bit read stays inside the mapped base.

    HMI and touchscreens

  • Selection guide

    Choosing a PC-based HMI runtime for a Modbus TCP PLC

    No — C-more projects deploy to C-more panel hardware, so a PC-only interface needs a PC runtime instead. Run AdvancedHMI, a PyQt5 front end with pymodbus, or an Excel VBA socket client as the Modbus TCP client, with the PLC acting as the server on TCP port 502.

    HMI and touchscreens

Setting hh and mm on an HMI week timer minutes word