How a PLC detects an HMI connection: heartbeat and port status

6 min read · Published November 11, 2026

A panel that writes its screen and button words only on change leaves the PLC nothing to watch while it sits idle. Read the serial port status register that matches the port, or have the panel write an incrementing heartbeat tag on a timer. Set the watchdog at three times the write interval: a 1000 ms heartbeat gets a 3 s timeout and flags a dead link in 3 s.

Overwrite the panel's screen number word, wait for the panel to write it back, and nothing comes back while the screen sits still: the panel updates that word only when the screen changes. The button status word behaves the same way. An idle panel is a quiet panel, and quiet is not the same as disconnected, so words that move only on operator action cannot tell the PLC whether the link is alive. Watch one of two things instead: the serial port status register that matches the port the panel is plugged into, or a heartbeat tag the panel writes on a timer. Both paths below are worked on a CLICK PLC, where the candidate port registers are SD41, SD51 and SD61, and the watchdog timeout is sized so the alarm lands inside the time your cell can tolerate.

What each symptom points to

  • The overwritten word never comes back. The panel writes the screen number word only when the displayed screen changes, so an untouched value says only that no one changed screens. Build the connection signal from the port status register or a heartbeat instead.
  • The button status word sits still while the line runs. Same cause: button words update on a press, not on a schedule. Overwriting them more often changes nothing.
  • The fault bit trips while the operator is still using the panel. The timeout is at or below the panel's real write gap, so normal pauses look like failures. Raise the timeout to three times the write interval and retest.
  • The port status register never moves when you unplug the panel. Either the register is the wrong word for that port, or the bit you watched is not the link indication. Re-check the port mapping in the manual and confirm the test pulled the panel's cable, not another device's.

Read the port status register for that port

A CLICK CPU carries a status word for each of its serial ports, and the candidates are SD41, SD51 and SD61. Match the register to the physical port the panel's cable lands on; a register picked by trial can be watching a port nobody uses. The CLICK user manual, manual number C0-USER-M, documents the system data words and covers the serial links in its communications chapter: copy each register's connected and disconnected indication from there instead of guessing a bit value or a polarity.

Then verify live. With the software online, watch the register while the panel is connected and in use, note the value, pull the panel's cable at a planned stop, note the value again, and restore the link. A word that sits still through both states is either the wrong register for that port or not a link indication, and alarm logic built on it stays wrong.

Have the panel write a heartbeat

If the panel's configuration tool can write a tag to the PLC on a schedule, build a heartbeat instead. Write an incrementing counter to a spare register: 0, 1, 2, 3, back to 0. The value has to change on every write, because the PLC can only compare the values it receives, and a counter that repeats the same number reads exactly like a counter nobody writes.

The counter technique is the same one behind verifying HMI communications with a PLC heartbeat counter; the watchdog timeout is what turns the counter into a connection alarm, and it is sized below.

Panel platforms schedule the periodic write differently. One driver publishes the heartbeat in its settings with a documented default interval of 1000 ms between checks. Another exposes an INTERVAL function that re-evaluates on a fixed period. A third documents a periodic task set to a 16 second interval, which is slow for machine states and acceptable for a schedule screen.

Worked example: 1 second heartbeat against a 5 second alarm requirement

Inputs. The heartbeat interval I = 1000 ms (1 s), the documented default in one panel driver's heartbeat settings. The alarm requirement T_req = 5 s, this line's rule that a dead panel link must be flagged within 5 s; substitute your own number. The margin basis: a polled serial link can lose a single write to noise or a retry, so the timeout must survive two consecutive missed writes and trip on the third.

The rule. Set the watchdog timeout at T = 3 × I. The alarm then sets T after the last successful write, while the worst normal gap, one missed write, tops out at 2 × I and stays clear of the trip point.

Arithmetic. T = 3 × 1 s = 3 s. Margin check: 2 × 1 s = 2 s of worst-case normal gap, below the 3 s timeout, so one missed write cannot trip the alarm. Requirement check: 3 s ≤ 5 s, so the alarm lands 2 s inside the requirement.

Result. A 3 s watchdog. The logic: a self-resetting 3 s timer latches the heartbeat word each cycle; if the fresh word equals the latched copy, set a clearly named fault bit, for example HMI_COMM_FAULT; if it differs, copy the new value and clear the bit.

Decision. At this interval, set the timeout to 3 s: a dead link flags between 2 s and 3 s after the failure, because the alarm is keyed to the last write and the failure can land anywhere in the 1 s between writes. If the requirement tightens to 2 s, shorten the interval first: I ≤ T_req ÷ 3 = 2 s ÷ 3 ≈ 0.67 s, so write every 500 ms and set the timeout to 3 × 500 ms = 1.5 s. For a panel that only carries a schedule, a 16 s task gives 3 × 16 s = 48 s of detection, a reasonable trade where nobody stands waiting on the answer.

Check it before you trust it

  1. Watch the heartbeat word online: it steps once per second. Watch the screen number word while someone operates the panel: it moves only on screen changes. Both behaviors you are depending on, confirmed in one pass.
  2. Record the port status word with the panel connected. Put the cell in a safe state, pull the panel's cable, record the word, restore the link, record again. Run this test at a planned stop and never on a machine whose motion or permissives depend on that link.
  3. Time the watchdog: pull the cable again and confirm the fault bit sets 3 s after the last counter step, plus a scan or two, and clears on the first changed write after the link returns.
  4. Write the port, the register or tag, the connected and disconnected values, and the interval into the maintenance notes, so the next troubleshooter starts from recorded facts.

Put the fault bit to work

Map the verified indication to a clearly named bit and decide what it may touch. Use it for an alarm, a log entry, or to inhibit the functions that genuinely need the panel: recipe edits, manual entry, trend views. Keep an unverified status bit out of motion permissives and out of anything that defeats an existing interlock. If the register's live behavior ever contradicts the manual, stop before deploying the logic and take the CPU model, the port, the register and the recorded values to the PLC vendor's technical support.

If the link will not come back after a restore, that is a setup fault with its own walkthrough: fixing an HMI PLC Ethernet connection timeout on a first setup.

Recommendation: If the panel's configuration can write a tag on a timer, run the heartbeat: increment a spare register every 1000 ms, set the watchdog at three times that interval, and keep the port status register as the second indication. Run the port status register alone when the panel cannot write on a schedule and you have watched its connected and disconnected indications live. On a CLICK CPU, confirm the register for your port in the user manual before either path goes live.

Questions

Why not use the panel's own connection error message?

That message is built for the operator standing in front of the panel. Unless the panel is configured to write a status tag back to the PLC, it never reaches your logic, and it disappears exactly when the link fails. The PLC needs a source it reads itself: the port status word or the heartbeat counter.

What if the heartbeat gap stretches on a busy serial port?

Measure the gap before sizing anything: watch the counter online through a full production cycle and note the largest gap between steps. The panel's writes share the port with every poll and every other exchange, so the real gap can exceed the configured interval. Keep the timeout at three times the largest gap you record, then check it against the alarm requirement.

Does the heartbeat method work over Ethernet?

Yes, unchanged: a timed write is visible whatever carries it. The three port status words named in the article belong to the serial ports, so for an Ethernet panel look for the CPU's documented Ethernet status indication or run the heartbeat alone. Size the timeout with the same three-interval rule.

What happens when the heartbeat counter reaches its top value?

Nothing, as long as it steps by 1. Wrapping from the register's top value back to 0 is still a change, and the comparison only looks for change. The failure mode is stepping by a multiple of the wrap range, where the word can land back on its old value and hide a dead link. Step by 1 and that cannot happen.

Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.

Keep reading

Build your signAsk for a quote