How-to
Setting HMI clock time from PC and PLC daily
Short answer
Connecting a PC or PLC to an HMI synchronizes nothing. Set the HMI clock once from the PC, then let a daily script triggered by a PLC bit copy the HMI clock into the FX clock registers D8013–D8019 through the PLC's time-write instruction, and verify each hop with an independent read-back; on an A series CPU only the register numbers change.
On this page
A cable between a PC, a Pro-face HMI and a Mitsubishi PLC carries process data, not time. None of those connections sets a clock, which is why an HMI can sit at the wrong time for weeks. The working setup is: set the HMI clock once from the PC, treat the HMI as the machine's master clock, and let a daily job copy the HMI clock into the PLC clock registers, D8013 to D8019 on an FX CPU, using a project script and the PLC's time-write instruction. On an A series CPU the same seven fields land in different registers, and nothing else in the design changes. Below are the register layout, the wiring steps, a worked 03:00 sync, and the checks that prove the write landed.
Pick one master clock before you configure anything #
Three clocks run on this machine: the PC, the HMI and the PLC each keep their own real-time clock on their own crystal, and connecting them does not reconcile them. The mismatches show up in your records: data the HMI software writes to CSV can be stamped from the PC clock, the alarm history stamps from the HMI clock, and the PLC program stamps sequence events from its own clock. One master clock is what keeps those on a single timeline.
Make the HMI the master. The PC sets it at commissioning; the PLC receives it once a day and never sends time back. Note that the documented automatic update in GP-Pro EX runs the opposite direction: under Common Settings, Clock Update Settings reads the device/PLC clock and updates the display unit's clock, the documentation's example running every hour. That feature serves a PLC-master design. With the HMI as master, leave it disabled, because with it on, the two clocks chase each other and the displayed time steps back and forth.
Set the HMI clock from the PC once, correctly #
Fix the source first. On the PC, confirm the time service is syncing to a network source, the time zone is right and the displayed time is right; the HMI can only hold the value you give it.
Then write the terminal's clock. The GP-Pro EX route documented for automatic date setting converts the data to BCD and writes it either to the PLC or to the display unit's clock, so use the clock-set side of that. Older terminal manuals define the clock preset as a four-word clock data area written in BCD; either way the fields are the same year-to-second values you see on screen. After the write, open the terminal's own clock display next to the PC clock and read both across a second boundary. Anything more than the few seconds a real-time clock drifts in a day means the write did not take, and everything downstream of the HMI will be wrong on schedule.
The FX clock registers you are writing to #
An FX CPU keeps its real-time clock in seven special data registers:
| Register | Field | Range |
|---|---|---|
| D8013 | Second | 0 to 59 |
| D8014 | Minute | 0 to 59 |
| D8015 | Hour | 0 to 23 |
| D8016 | Day of month | 1 to 31 |
| D8017 | Month | 1 to 12 |
| D8018 | Year | 2000 to 2079 in 2-digit year mode |
| D8019 | Day of week | 0 to 6, where 0 is Sunday |
All seven hold BCD, and the FX3 clock sample ladder manual, written for the FX3S, FX3G, FX3GC and FX3U families, gives D8018 its year range of 2000 to 2079 in 2-digit year mode. You do not write these registers as ordinary data: the documented method is the FX time-write instruction (TWR), which copies seven ordinary registers laid out in this same order into the clock. So the HMI writes seven staging registers and a PLC rung turns that into a clock set. The staging addresses in this article are illustrative: I use D200 to D206, and you pick any free block.
On an A series CPU the clock lives in its own special registers. The CPU manual's clock data table lists the register numbers and the field order, so map all seven fields from that table and keep the rest of this design unchanged.
Wire the daily HMI-to-PLC write #
The write chain is the same pattern as keeping HMI-entered timer presets in PLC memory, data flowing from the HMI into controller registers, except the data is the clock and the trigger is a schedule instead of an operator entry.
- Pick the trigger time, 03:00 in this design, and add a PLC rung that switches on request bit M100 when D8015 (hour) equals 3 and D8014 (minute) equals 0. The clock registers hold BCD, and BCD 0003 and BCD 0000 read as decimal 3 and 0 in a plain compare, so single-digit compares need no conversion. Because the trigger uses only hour and minute, it still fires on schedule even when the PLC date is wrong, which is exactly when you need it.
- Latch a done bit with the same rung, and reset that done bit whenever D8014 is not 0. The request now fires once per day and re-arms at 03:01.
- In the HMI project, add a D-script in GP-Pro EX with M100 as its trigger. The script reads the terminal's own clock fields, year, month, day, hour, minute, second and day of week, converts each to BCD and writes them to D200 to D206 in the layout of the table above.
- End the same script by switching on M101, the write-done bit.
- Add the final PLC rung: on M101, execute the time-write instruction with D200 as its source, so D200 to D206 land in D8013 to D8019, then reset M100 and M101.
- Force M100 on once from the programming tool to run a controlled write, verify it, and only then leave the schedule standing. The bit numbers here are illustrative; use any free bit devices.
One caution: a write that sets the clock backwards reorders time-stamped alarms, logs and batch records, so keep the trigger in a quiet window rather than mid-production.
Worked example: FX PLC synced at 03:00 #
At 03:00:05 on Tuesday 17 June 2025 the script fires and reads the HMI clock. The seven staging registers receive:
| Register | Field | Value written |
|---|---|---|
| D200 | Second | 5 |
| D201 | Minute | 0 |
| D202 | Hour | 3 |
| D203 | Day of month | 17 |
| D204 | Month | 6 |
| D205 | Year | 25 |
| D206 | Day of week | 2 (Tuesday) |
The arithmetic behind three of those values: the year is 2025 minus 2000, which is 25 and sits inside the documented 2000-to-2079 range for D8018 in 2-digit mode; the day 17 becomes BCD 16#0017, a 1 in the tens nibble and a 7 in the units nibble; and the day of week comes from 1 June 2025 being a Sunday, so 17 June is 16 days later, 16 mod 7 = 2, which is Tuesday, written as 2.
The time-write instruction then lands D200 to D206 in D8013 to D8019. The device monitor shows D8016 = 16#17, D8018 = 16#25 and D8019 = 16#02, and the PLC clock reads 03:00:05 on Tuesday 17 June 2025. The whole write takes well under a second, so the PLC clock only gives up the small skew it had accumulated since its own 03:00 tick.
Verify each hop independently #
Test the chain hop by hop before trusting the schedule. Hop one, PC to HMI: the side-by-side second comparison from the setup step. Hop two, HMI to PLC: after a forced write, monitor D8013 to D8019 from the programming tool's device monitor, not from an HMI screen object, because a screen field echoing the value you just wrote proves the write path, not the clock. Check D8018 and D8019 first; a wrong year or weekday exposes a field-order or encoding mistake instantly.
For a permanent cross-check, the HMI's System Data Area can be mapped into PLC devices such as data registers or data memory. Where your terminal exposes its clock there, map it to a few unused registers and compare that copy against D8013 to D8019 after each daily write, which gives you two independent pictures of the same time.
Then leave the schedule standing overnight and check once more the next morning. If the PLC is wrong after the write, the fault is in the mapping or the trigger; if both clocks are wrong, the HMI clock needs the PC reset first. After any extended power outage, set the HMI from the PC before the next write runs, or the job will faithfully copy a dead clock.
The decision for each case #
FX PLC (FX3S, FX3G, FX3GC, FX3U and the rest of the family with these clock registers): HMI is master; Clock Update Settings stays off; the PC sets the HMI clock at commissioning; the D-script writes seven BCD words to a staging block on the PLC-triggered bit; the PLC rung runs the time-write instruction into D8013 to D8019 at 03:00; verify D8018 and D8019 from the device monitor after the first write.
A series PLC: same HMI-side steps and same trigger; map the seven fields to the CPU's own clock data registers from the CPU manual's table and point the write at that mapping.
Site policy keeps the PC as master: run the documented update in its native direction instead. Keep the PLC synced from the PC's time source, enable the PLC-to-HMI clock update, and skip the daily HMI-to-PLC write entirely.
Other controller families follow the same shape. The Siemens S7-1200 version of a daily clock task is on the page configuring the S7-1200 real-time clock for daily scheduled tasks, and the Allen-Bradley SLC 5/05 version of a scheduled trigger off system clock registers is on the page daily duty rotation at 10:00 AM using SLC 5/05 system clock registers.
Questions asked
Why do the HMI and PLC clocks drift apart between writes?
Both clocks are crystal-driven real-time clocks, and crystals run fast or slow by tens of parts per million. At a typical 50 ppm that is 0.00005 x 86,400 s, about 4.3 seconds per day. The daily write re-zeroes the PLC side every 24 hours, so the two clocks disagree by at most roughly one day's drift; the HMI side is only corrected when you reset it from the PC.
Does the daily write survive a project download or a power cycle?
Yes. The script is part of the HMI project and the rungs are part of the PLC program, so both come back after a download or a power cycle. What may not come back is the HMI's clock: if the terminal's RTC backup does not hold through a long outage, the HMI wakes on a default date. Set it from the PC before the next write runs, or the job will copy the dead clock into the PLC.
What happens if the day-of-week value is wrong?
D8019 is also BCD and runs 0 to 6 with 0 as Sunday. A wrong value does not corrupt the date fields, since the calendar still advances correctly, but any report or interlock that filters by weekday runs on the wrong day until the next daily write lands a corrected value from the HMI.
Can one HMI keep several PLC clocks in step?
Yes. Give every connected PLC its own staging block and done bit, extend the script to write the same seven BCD values into each block, and let each PLC run its own time-write instruction on its own done bit. All PLC clocks then stay within one write interval of the HMI, and because the HMI remains the single master, no two PLC clocks can chase each other.