Show a digital clock on an HMI panel from PLC RTC values

5 min read · Published November 12, 2026

A small graphic panel with no clock object can still show a digital clock: bind numeric display objects to the PLC's real-time clock registers, poll the two tags every second, and the display follows the controller's timekeeping instead of a value copied once at startup.

A graphic panel with no clock object of its own can still show a digital clock: it reads the time from the PLC. Most controllers keep a real-time clock in registers the panel can read with its normal driver. Bind the hour and minute values to numeric display objects and refresh them at a fixed interval. The clock then follows the controller's timekeeping, survives screen changes and panel restarts, and stays correct as long as the controller's clock is correct. This page lists what you need, the five steps, the update interval that keeps the display honest, and the checks that tell a live clock from a value copied once at startup.

What you need

  • A controller with a real-time clock. If yours has none, the panel has nothing to read; reading the system time in CODESYS when the controller has no RTC covers that case.
  • The clock's register addresses or tag names, from the controller manual's system-data table.
  • The panel project software, with its driver for that controller already communicating.
  • Two numeric display objects and one text object for the colon.

Build the clock on the screen

  1. Check the object list first. Open the panel project and look for a clock or date/time object. Larger panels often ship one; if yours has it, place it and stop here. The steps below are for the panels that do not.
  2. Confirm the controller clock is live. Go online with the controller and watch its clock values roll over at the next minute boundary. If the values are frozen or wrong after a power cut, fix the controller clock first; the panel cannot display a time the controller is not providing. Setting a PLC clock from the operator panel, including ahead of daylight-saving changes, is its own job with its own pitfalls.
  3. Check the format. Clock values sit either in separate registers for hour, minute and second, or in one packed structure such as a DTL-type tag. Note whether the registers are binary or BCD packed: BCD stores 14:37 as 0x14 and 0x37, and a panel that reads those bytes as plain binary shows 20:55. Wrong-format digits look plausible, so this check saves an hour of head-scratching.
  4. Bind the objects. Place two numeric display objects, bind one to the hour register and one to the minute register, set both to two digits with a leading zero, and put a fixed text object with a colon between them.
  5. Set the update interval to 1 s. Enter it for both tags, save, download the project with your normal procedure, and watch the minute roll over on screen.

Pick the update interval

The display is only as fresh as its last read. With a 1 s interval the clock trails the controller by one interval plus one comms cycle. On a serial link at 9600 baud, a two-register read and its answer together are 17 bytes, counted from a standard register-read frame. With no parity bit each byte takes 10 bits on the wire, so 170 bits is 17.7 ms, call it 25 ms with the framing silences. Worst case, the screen is about 1.03 s behind the controller clock. An hours-and-minutes display changes once a minute, so a 1.03 s lag never shows. Add the seconds register too if you want a ticking digit; the example below gives the interval that keeps the ticks even.

Two clocks on one machine

The clock on the screen follows the controller. A panel that has its own real-time clock uses that clock to stamp its trend graphs and alarm logs, which is how such panels are documented to work. The display and the log stamps can therefore disagree until both clocks are set from the same reference. Set them together, or switch on the panel's time-synchronization option if its system settings offer one. The opposite direction, writing the panel's setting into the controller and keeping trend axes on true time, is covered in setting an HMI clock from the PLC and reading trend axes in time.

Example: an hours-and-minutes clock on a 4-inch panel over a serial link

Inputs. Panel: a 4-inch graphic panel with no clock object, the small-panel case this page answers. Controller: any PLC with a real-time clock; its clock registers hold hour 14 and minute 37 at the moment of the check (illustrative values). Update interval: 1 s, the setting entered in step 5. Link: serial at 9600 baud, no parity, the usual serial line setting. Crystal tolerance: ±20 ppm, the usual figure for the 32.768 kHz crystal that times a controller's real-time clock.

Rule in words. Worst-case display lag is one update interval plus one comms cycle. Monthly drift is the crystal tolerance multiplied by the seconds in a month.

Arithmetic. Comms cycle: the two-register exchange is 17 bytes, so 17 × 10 bits = 170 bits, and 170 ÷ 9600 baud = 17.7 ms, about 25 ms with framing silences. Lag: 1 s + 0.025 s = 1.03 s. Drift: a 31-day month is 31 × 86,400 s = 2,678,400 s, and 20 × 10⁻⁶ × 2,678,400 s = 53.6 s.

Result. The panel shows 14:37 at most 1.03 s after the controller clock turns to 14:37. The controller clock itself drifts at most about 54 s over that 31-day month.

Decision. At a 1 s update interval the hours-and-minutes clock never looks stale, because 1.03 s is invisible against the 60 s display resolution of a minutes field. Correct the controller clock about once a month, and before any shift whose records depend on its timestamps. If the screen also shows the seconds digit, drop the interval to 500 ms; the value still steps once per second, but each step is caught close to when it happens and the tick reads even.

How to check it worked

  • Stand at the panel at a minute rollover with the controller online beside you: the digits change within about a second of the controller's values changing.
  • Compare the screen with a phone or office clock: the hour and minute match.
  • Power-cycle the panel: the clock comes back correct without reopening the screen, because the values are read from the controller again, not stored in the project.
  • Power-cycle the controller too: if the time comes back wrong, the controller's clock backup failed, which is controller maintenance, not a display fault.
  • Leave it running for a month and compare again: a gap near a minute is the drift the example predicts. Correct the clock and carry on.

Recommendation

Recommendation: When the panel has no clock object, bind the hour and minute registers to numeric display objects and poll the two tags at the interval from the worked example. Use the panel's own clock object instead whenever the object list has one, because it keeps ticking without depending on the comms link. Correct the controller clock on the schedule the example works out, and after every power cut, before trusting its timestamps in production records.

That fixes the machine clock. If the line also needs a standing board for shift targets, quality scores or safety messages, that is a different screen doing a different job; we build shop-floor signage displays for exactly that.

Questions

Can the panel show the seconds ticking as well?

Yes. Bind the seconds register like the hour and minute and keep the update interval at 1 s. The digit stays within about a second of true time, but the ticks can bunch up or skip because the display only refreshes once per interval. If an even tick matters, shorten the interval to 500 ms. Doubling the reads of two or three clock tags is a light load for the controller and the link.

Why do my trend and alarm timestamps disagree with the clock on the screen?

Run a five-minute test to find out which clock writes them. Set the panel's own clock deliberately wrong by five minutes, trigger one alarm, and open the log. If the stamp is five minutes off, the panel's clock wrote it; if the stamp is right, the controller's clock did. Set the guilty clock from a trusted reference, or enable the time synchronization option in the panel's system settings if its documentation offers one.

The displayed time is wrong after a power cut. Is the display at fault?

Almost never. The screen mirrors whatever it reads from the controller, so a wrong time after restart points at the controller's clock backup, usually a battery or supercapacitor that did not carry the clock through the outage. Set the controller clock to the correct time using its documented procedure, then power-cycle it once more to confirm the clock holds through a restart.

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