An HMI numeric object offers a period or a comma as its separator and no colon, so format a time as message text instead: embed three integer tags for hours, minutes and seconds and type the colons between them. Split one total-seconds count in the PLC with integer divide and modulo by 3600 and 60, then prove the screen against 59, 60 and 3599 seconds.
A numeric display object formats one number, and its separator list holds exactly two marks: a period or a comma. Neither is a colon, so no setting inside the object will print 12:34:56 out of a single register. The working method is to move the formatting out of the object and into a message: embed three integer tags for hours, minutes and seconds, and type the colons between them as literal text, HOUR:MINUTE:SECOND. The PLC side does the arithmetic first, splitting a total-seconds count with integer divide and modulo by 3600 and 60. This page walks through the source data, the split, the message build and the test values that prove the screen.
Why the separator list has no colon
A numeric object shows a whole part, a separator mark and fractional digits. The digits are a base-10 fraction, so the mark is a decimal point, and the property list offers its two spellings: a period or a comma. Open the object's properties and read the list. If it holds a period and a comma and nothing else, the object has no colon to give you, and time fields count in base 60 anyway: minutes run 0 to 59 and seconds run 0 to 59, so a decimal fraction cannot carry them.
That mismatch is what sinks the usual workarounds.
| Attempt | Result |
|---|---|
| Pick the comma separator | Swaps the period for a comma. Still a decimal mark, still no colon. |
| Store 1.45 and let the fraction stand for minutes | A two-digit fraction counts 0 to 99 while minutes count 0 to 59. The value 1.75 prints 75 after the mark, which reads as an impossible minute; typing 1.45 for a true 45 minutes stores 1 h 27 min. |
| Use the panel's clock object | A clock object reads the panel's real-time clock and has no input for a memory location, so it shows wall time and nothing about a timer or a register. |
| Three numeric objects with typed colons between them | Works as a temporary restore. Each object keeps its own width, so the layout drifts when digit counts change, and every time field becomes three objects to maintain. |
What you need
- The time in the PLC in one of two forms: three integer registers (hours, minutes, seconds) or one elapsed-seconds count.
- For a single count, three integer destinations for the split result.
- HMI programming software with a message database, or any text object that accepts embedded variables.
- A message or text display object on the screen.
- A download path to the panel for the test.
If you have never placed a variable inside message text, your HMI editor's manual for its message database or text object covers the mechanics; the only extra step here is typing the colons as literal characters between the three tags.
Sort the source data first
Monitor the registers in the PLC, not on the panel, and note which of three forms the time takes.
- Three separate integers, one each for hours, minutes and seconds: skip the split and go straight to the message build.
- One elapsed-seconds count from a timer or counter accumulator: do the split in the PLC before anything reaches the screen.
- A decimal such as 12.34 standing in for 12:34: move the two parts into separate integer registers first. A base-10 decimal cannot carry base-60 fields, and no formatting on the display side repairs the digits.
There is one shortcut. If the screen only has to show the panel's current wall time, the clock object already does it and no registers are involved. For a date with a 12-hour clock on one line, your package's clock and text objects carry the same embedded-field mechanics described below.
Split total seconds in the PLC
In words: integer-divide the total by 3600 to get hours. The remainder of that divide holds everything under one hour; integer-divide it by 60 to get minutes, and what is left is seconds. Integer divide truncates, which is what a clock does with a partial hour and a partial minute.
The same split sits behind a rolling 24 hour runtime for a pump display, where the counter also accumulates whole seconds, so build the accumulation once and reuse it.
The names and types below are illustrative. Use your platform's integer divide and remainder instructions and keep the destinations integer-typed, so each divide truncates.
TotalSec : DINT := 3725; (* whole seconds from the timer accumulator *)
Hours : DINT := 0;
Minutes : DINT := 0;
Seconds : DINT := 0;
Hours := TotalSec / 3600; (* integer divide *)
Minutes := (TotalSec MOD 3600) / 60; (* integer divide *)
Seconds := TotalSec MOD 60; (* remainder *)
In ladder the same three results come from the divide instruction and the remainder instruction with the constants 3600 and 60.
If the count arrives as two 16-bit words that form a 32-bit value, confirm the word order before the split. A swapped pair produces a huge but plausible hours count, and nothing on the screen looks obviously broken.
Worked example: a batch timer at 3725 seconds
Inputs: TotalSec = 3725 s, one 32-bit integer in the PLC that a batch cycle timer increments once per second. The divisors are fixed: 3600 s per hour and 60 s per minute. The variable name is illustrative; the case is any elapsed-seconds count, and this value is a typical batch time.
Rule: hours are TotalSec divided by 3600 with the remainder kept; minutes are that remainder divided by 60 with the remainder kept; seconds are the final remainder.
Arithmetic:
- Hours: 3725 ÷ 3600 = 1 remainder 125 (1 × 3600 = 3600; 3725 − 3600 = 125).
- Minutes: 125 ÷ 60 = 2 remainder 5 (2 × 60 = 120; 125 − 120 = 5).
- Seconds: 5.
Result: 1 h, 2 min, 5 s, printed as two digits each, so the message reads 01:02:05.
Decision: force the accumulator to 3725 and the screen must show 01:02:05. Two-digit hours carry every total up to 359999 s, which prints 99:59:59. The next second, 360000 s, needs a third hour digit, so widen the hours field when you build the message or reset the counter at the end of each shift.
Build the HH:MM:SS message
- Create three integer tags in the panel tag database, one for each register the split writes, or for the three original registers.
- Add a new message in the message database.
- Insert the hours tag as an embedded data value, type :, insert the minutes tag, type :, then insert the seconds tag. The layout reads HOUR:MINUTE:SECOND.
- Set each embedded field to two digits with leading-zero fill, so a raw 5 prints 05.
- Place the message display object on the screen and assign the new message to it. Size the object for the widest string you expect, eight characters for HH:MM:SS.
- Download the project to the panel and run the checks below.
Recommendation: Drive one message entry with three embedded integer tags whenever the time comes from a register, a timer or an elapsed count, and split the count in the PLC first so each tag carries a whole number. Keep the three-numeric-object layout only as a temporary restore that runs the line before the message is built, and reach for the clock object only when the screen needs the panel's current wall time.
Check it against known values
Force the source register, or all three registers, to the values in the table and read the screen. The expected strings come straight from the split.
| Total seconds | Screen shows |
|---|---|
| 0 | 00:00:00 |
| 59 | 00:00:59 |
| 60 | 00:01:00 |
| 3599 | 00:59:59 |
| 3600 | 01:00:00 |
| 86399 | 23:59:59 |
59 s is the last second with no full minute, 60 s is the first minute carry, 3599 s is the last second with zero hours and 3600 s is the first hour carry. If a row disagrees, the split is wrong, not the message. When all six agree, let the value count live and watch the seconds roll into minutes with the string width unchanged.
Pitfalls once it runs
- Leading zeros missing. 1:2:5 on the screen means the embedded fields print raw values; set two digits with leading-zero fill on all three fields.
- Hours outgrow the object. Past the two-digit hour ceiling the hour field needs a third digit; widen the message and the object together.
- A signed register crosses zero. A countdown through zero prints a minus sign and shifts every field. Clamp the total at zero in the PLC or format it as time remaining.
- The tag points at a register the PLC stopped writing. Watch the register in the PLC and the object on the panel at the same time. A register that moves with a still screen means the tag address is wrong; repoint it.
If you also want a separate shop-floor notice or status screen next to the machine, our industrial displays for shop-floor signage are built for that job.
Questions
What if my HMI package has no message database?
Most packages carry the same feature under another name: a text object, a string display or a text list that accepts a variable in mid-string. The mechanics are identical: three integer variables, literal colons typed between them, one display object sized for the widest string. Look through the editor's object list for any text object with an insert-variable button and build the same HOUR:MINUTE:SECOND layout there.
How do I show a total above 99 hours?
Give the hours tag a three-digit field so the string becomes HHH:MM:SS, nine characters wide, and widen the message object to match. The split arithmetic is unchanged: 360000 seconds divides to 100 h exactly. If the counter resets each shift, two digits are enough and the eight-character width stands.
How do I catch a 32-bit word order problem?
Force the total to 86399 and read the hours field. Correct order gives 23:59:59. A swapped word pair reads 86399 as a ten-digit seconds count, so the hours field shows a six-figure number instead of 23.
Planning information, not legal or engineering advice. Rules differ by place: check codes and permits with your local authority and your licensed trades.