Set a PLC clock from an HMI without breaking the packed format

7 min read · Published November 11, 2026

Displaying hh:mm:ss and dd:mm:yr reads separate registers; setting the clock consumes one packed block and an instruction run from ladder. Stage each edit in its own register, range-check the fields at the PLC, pack the documented layout, and run the TIME or DATE instruction once on the accept press.

To set a PLC clock from an HMI without breaking the packed format, stage the operator's edits in registers of their own, range-check them in the PLC, pack them into the block layout the clock instruction documents, and run that instruction once from ladder on the accept press. A screen that already shows hh:mm:ss and dd:mm:yr has finished only the read side. The display reads one register per field, already separated. The write side is one packed block in V-memory, in an order the manual defines, plus an instruction call. Build the write path once and every clock screen after it reuses the same rungs.

Two data paths, one clock screen

The read path separates. Each field on the screen, hours, minutes, seconds, day, month, year, is tagged to its own register, and the values arrive already split. The seconds register steps up by 1 every second, so a live read takes seconds to confirm.

The write path packs. The clock-setting instructions in the PLC family used here, named TIME and DATE in the manual, consume one block: the fields sit together in a fixed layout the manual defines, and the instruction runs only when ladder logic calls it. The screen's field order, hh:mm:ss and dd:mm:yr, is a presentation choice. It is not the order the instruction reads; that order lives in the manual's instruction chapter.

Symptoms and what each points to

Four failures cover nearly every clock screen that misbehaves. Find the row that matches what you see before changing any logic.

What you see What it points to Next check
Fields show values in the wrong order or with impossible digits, for example 85 in the minutes field Display object formatting or a wrong tag address Watch the live registers in the PLC programming software and compare each field's tag
The staged values change on screen but the PLC clock stays old Nothing packs the block, or the instruction never runs Watch the packed block and the instruction rung while the accept press is made
The PLC clock jumps to values no clock can hold The block's field order does not match the documented layout Recheck the manual's field list, register by register
The clock changed but the screen still shows the old time The display objects read different addresses than the clock registers Compare the screen tags against the live clock registers

The first and last rows are screen problems and end at the screen. The middle two are the write path, and those are the ones a working display leaves hidden.

Check the read path before building anything

Go online with the programming software and watch the clock registers while the clock screen is up. The seconds field steps by 1 each second and the minutes field rolls over from 59 to 0, so within half a minute you know whether the screen tags point at the live clock. Compare field by field: same digits, same order, same roll-over moment.

If the registers advance and the screen is wrong, fix the screen objects first; the address checks in HMI numeric display shows nothing: check the tag address first apply unchanged. If the registers themselves are static, sort out the PLC clock and the communications link first, because the edit path needs a live clock to verify against. Once the read path is right, leave it alone; it needs no changes to support edits.

Stage the edits in registers the clock logic owns

Give every field its own staging register and its own numeric entry object on the screen: hours, minutes, seconds, day, month, year, six registers that belong to the clock logic and to nothing else. Point the edit objects at the staging registers, never at the live clock registers, so the change lands on the accept press and not on the first keystroke.

In the PLC, one rung per field checks the range, and ANDing the six pass bits produces one entry-valid bit. The next rungs assemble the packed block in the layout the manual prints for the TIME and DATE instructions. A one-shot on the accept press then runs the instruction once. If other screens or other logic write near the staging area, guard those registers for the duration of the edit; the approach in lock a PLC V-memory value from HMI writes during a stage carries straight over. Packing several fields into V-memory words is the same job whether the fields are numbers or text, and pack an ASCII string into V-memory words for an HMI tag walks the mechanics field by field.

Example: staging 14:07:05 on 18 November

Inputs. An operator correcting the clock after a PLC swap keys, on the clock screen, hours 14, minutes 7, seconds 5, day 18, month 11 and year 09, in the dd:mm:yr field order this setup displays. The entry values are illustrative; the limits are calendar rules: hours 0 to 23, minutes and seconds 0 to 59, months 1 to 12, a day from 1 to the month's length, which is 31 in November, and a two-digit year field spanning 00 to 99.

Rule. Every field must pass its range check before any packed value is written or any instruction runs. One failed field rejects the whole edit at the screen, and the PLC writes nothing to the clock area.

Arithmetic.

  • Hours: 14 lies between 0 and 23, pass.
  • Minutes: 7 lies between 0 and 59, pass.
  • Seconds: 5 lies between 0 and 59, pass.
  • Month: 11 lies between 1 and 12, pass.
  • Day: November holds 31 days, and 18 lies between 1 and 31, pass.
  • Year: 09 lies between 00 and 99, pass.

Result. All six fields pass, so the ladder copies 14, 07 and 05 into the time block and 18, 11 and the year value into the date block, in the field order the manual prints, and the request bit runs the clock instructions on that scan. The clock registers then read 14:07:05 on 18/11, and the screen shows it straight from those registers.

Decision. The edit is accepted and the instruction runs. The rule is all-or-nothing: had the operator keyed month 13, the comparison 13 > 12 fails, the screen shows a rejection, and the packed block and the clock are left untouched. After an accepted run, watch the seconds register for 60 seconds; stepping 05, 06, 07 without a gap confirms the clock is live and the screen is reading it.

The fix, rung by rung

  1. Tag six numeric entry objects on the screen to six staging registers: hours, minutes, seconds, day, month, year.
  2. Write one range-check rung per field with the limits from the example, and AND the six pass bits into one entry-valid bit.
  3. On a rung fed by the entry-valid bit, copy the staged values into the packed block the TIME and DATE instructions consume, in the field order and registers the PLC manual's standard instruction chapter prints. A clock-set routine from the vendor's example program library is a fair cross-check for that layout, once its addresses have been compared with your own project.
  4. Trigger the instruction from the accept press through a one-shot: the rung runs the clock instructions on the scan the request bit sets, and only when the entry-valid bit is true. Clear the request afterwards so one press cannot re-run the instruction on every later scan.
  5. Send an accepted bit and a rejected bit back to the screen, and let the rejected path name the field that failed where the logic can carry it.
  6. Keep display strings out of the packed block. A screen that writes formatted text into the registers the instruction reads hands the instruction characters where it expects numbers.

Verify the path once, then hand the screen over

Run one edit with the programming software online and watch four things in order: the staging registers follow the keys, the entry-valid bit sets only for a legal entry, the packed block matches the manual's layout, and the clock registers take the new values on the accept press. The screen shows the new time within a second of the press. Close with the 60 second register watch from the example, then hand the screen over.

One caution: the test edit lands in the real PLC clock, so alarm and record timestamps carry it. Run the check between shifts or on equipment that is not making product, and leave the clock on a true value at handover.

The same write path serves every later correction, including the seasonal one; choosing when to switch and by how much is covered in set a PLC clock from the operator panel for daylight saving time.

Recommendation: Stage every clock edit in registers the clock logic owns, range-check all six fields in the PLC, pack the documented block in ladder, and run the TIME or DATE instruction from a one-shot rung on the accept press. Bind edit fields directly to the clock registers only where the PLC manual itself documents that interface, and let a single failed field block the whole edit.

Questions

Can the HMI write the packed clock block directly?

It can write numbers into any register the panel can reach, but a six-field edit written field by field leaves the block half old until the last write lands, and the clock instruction consumes the whole block whenever it runs. Stage the fields in their own registers, range-check them in the PLC, pack once, and run the instruction on the accept press.

Where is the packed format documented?

In the PLC manual's standard ladder instruction chapter, in the entries for the TIME and DATE instructions: the field order, the registers the block occupies, and how the instruction reports an invalid or rejected value. The vendor's example program library usually carries a working clock-set routine as well; compare its buffer addresses with your own project before copying any of it.

Does this change anything for daylight saving time?

No. The write path is the same stage, check, pack and run sequence for the seasonal change. What changes is the planning: pick the switch-over moment in advance, keep it clear of a shift change, and expect timestamps on alarms and records to carry the new time from the moment the instruction runs.

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