IMDTouchKnowledge BaseShop main store

How-to

Display TIME as hh:mm:ss on a KTP700 Basic panel

HMI and touchscreens Published 5 min read By IMDTouch engineering team

Short answer

KTP700 Basic panels have no built-in duration format that renders an S7-1200 TIME tag readably, so 310500 shows as 310.500. Split the value in the PLC with integer division and MOD into hours, minutes, seconds and a millisecond remainder, then display the components in separate HMI fields, or build a string with Chars_TO_Strg.

On this page
  1. Check the format list first
  2. Confirm the source value and its units
  3. Split the duration in the PLC
  4. Choose separate fields or one string
  5. Verify rollover and edge cases
  6. Questions asked

On a KTP700 Basic there is no built-in format that renders an S7-1200 TIME tag as hours, minutes and seconds, so a TON1.ET value of 310500 arrives on screen as 310.500. The fix is to split the duration in the PLC with integer division and MOD into component tags, then show those tags in separate I/O fields — or assemble them into one STRING with the Chars_TO_Strg instruction. With 310500 ms the result is 0 h, 5 min, 10 s and 500 ms, which you display as 5:10 or 5:10:500.

Check the format list first #

TIME is a duration in milliseconds and TOD is a time of day; both occupy 4 bytes, but their meanings are not interchangeable. Open the I/O field properties for your panel target in the TIA Portal version you are using and look at the format pattern options for a Time tag. On Basic panels the list typically gives you the raw value with a decimal point, which is why 310500 shows as 310.500.

If your version offers a duration pattern with colons, use it: wire it to the timer's ET tag, download, and confirm the field reads 5:10 against a stopwatch. If it does not, which is the usual case on a Basic panel, do the split in the PLC. Do not retype a duration tag as TOD just to change the appearance; a time-of-day format applied to an elapsed duration invites exactly the unit mix-ups that make the raw number confusing in the first place.

Confirm the source value and its units #

Before converting anything, prove the tag you are reading and its unit. Put the HMI online, watch TON1.ET while a known timer runs, and compare the change over one measured second: a tag showing TIME counts milliseconds, so it should advance by about 1000 in one second of true elapsed time. If it advances by 1, you are looking at seconds already and every divisor below is off by a factor of 1000.

Formatting never changes units. If some other scaling has already divided the value, stop there and fix the mapping — the same discipline applies when you scale a PLC integer into an HMI display value.

Split the duration in the PLC #

For a nonnegative TIME value ms in milliseconds, four instructions give the display components:

  1. Hours — hours := ms / 3600000, with the division configured for integer (truncating) results.
  2. Minutes — minutes := ms / 60000, again truncated; the MOD below keeps this in the 0–59 range so it reads as a clock position, not a total.
  3. Seconds — seconds := (ms / 1000) MOD 60. The MOD instruction returns the remainder of the division; the same remainder arithmetic is used across platforms when a value has to wrap inside a fixed range.
  4. Milliseconds — milliseconds := ms MOD 1000.

Worked example, ms = 310500:

  • hours = 310500 / 3600000 = 0 (integer division)
  • minutes = 310500 / 60000 = 5
  • 310500 / 1000 = 310, then 310 MOD 60 = 10 seconds (310 − 5 × 60 = 10)
  • 310500 MOD 1000 = 500 ms

So the screen shows 5:10, or 5:10:500 with the remainder field. The MOD steps are what stop the seconds field from accumulating past 59: total seconds is 310, and only the remainder of 10 belongs in a clock-style display.

Declare the component tags in the PLC as unsigned integers large enough for their ranges — an hour count fits easily in 16 bits for any realistic machine runtime — and expose them in the HMI connection's PLC tags. One scan of simple integer division per timer is negligible even with many such variables, which is the concern when dozens of duration tags share a screen.

Choose separate fields or one string #

The component approach costs three extra tags and three I/O fields per duration, which is exactly why the string route exists. Build the text in the PLC instead: convert each component to characters, place them in an Array of CHAR with the colons between them, then call Chars_TO_Strg, which copies characters from an Array of CHAR or Array of BYTE into a STRING tag. One HMI field bound to that STRING shows 5:10.5-style output without any string handling on the panel.

The string route costs one screen object but one extra STRING tag and the character assembly in the PLC, so the honest trade is screen clutter against PLC code volume. For one or two durations, separate fields win on simplicity; for a screen full of timers, build the string once as a reusable block and call it per tag.

Configure leading zeros on the sub-hour fields — seconds 05, not 5 — in the I/O field's format settings so the display keeps a fixed width across the minute rollover.

Verify rollover and edge cases #

Run these on the bench with the HMI online before releasing the screen:

  • Known value: force or run to 310500 ms and expect 5:10 (or 5:10:500 with the remainder field).
  • Below one second: 800 ms must show minutes 0, seconds 0, remainder 800. A field showing 0:0 here means you read the wrong tag.
  • Minute boundary: at 60000 ms the seconds field must return to 0 and minutes step to 1; 0:60 on screen means the MOD step is missing.
  • Hour boundary: at 3600000 ms hours must step to 1 with both other components at 0. If your display omits hours, decide the behavior for values over 59 minutes 59 seconds — most screens accept the minutes count running on.

One safety note: a formatted duration is an operator aid only. Never use a reformatted TIME tag as the value a guard, interlock or safety-related comparison acts on; keep those decisions on the raw PLC value.

The end decision: if your TIA Portal version offers a duration format on the KTP700 Basic, test it with 310500 ms and use it. If it does not — the normal case — split the tag in the PLC with integer division and MOD into minutes, seconds and an optional millisecond remainder, show them in separate fields for a handful of timers, or assemble one STRING per tag with Chars_TO_Strg when the screen carries many.

Questions asked

Why does my KTP700 Basic show 310.500 instead of 5:10?

The panel has no duration format for the TIME data type on a Basic target, so the raw millisecond count is shown with a decimal point. Split the value in the PLC: minutes = 310500 divided by 60000 gives 5, seconds = 310500 divided by 1000 then MOD 60 gives 10. Show those two tags in separate I/O fields.

Can I declare TON1.ET as a TOD tag to get a time format on the HMI?

That is a reported workaround, not a documented one: TIME and TOD both occupy 4 bytes, and a panel configured to read the tag as time of day with the HMI Time format can render it with colons. Verify it in your TIA Portal version with a known value such as 310500 ms before trusting it on a production screen.

Does this change the timer's elapsed value?

No. Integer division and MOD only read the millisecond count of the elapsed time tag; they write the results to separate component tags and leave the timer untouched. The timer keeps timing while the display components update on the next scan.

Keep reading

  • How-to

    How to Display a Time-Until-Closed Countdown on an HMI

    Display time until closed by computing the timer preset minus the accumulated value (.PRE - .ACC) in the PLC and binding the numeric display to that result. Clamp the value to zero when the done bit sets, keep the operator's duration in its own tag, and let the timer-done rung in the controller close the valve - never the panel.

    HMI and touchscreens

  • How-to

    PLC timer value on an HMI: start, stop and show after a win

    Time the run in the PLC, not on the panel. A TONR accumulator runs while Sensor 1's run-active bit is high, Sensor 2 copies the elapsed value into a result tag and sets the win bit, and the KTP600 shows that one tag on an I/O field while the PLC-driven screen change opens the winning screen.

    HMI and touchscreens

  • How-to

    Enter S5TIME timer presets from an HMI in TIA Portal

    The panel cannot enter S5TIME directly: it is a packed 16-bit BCD word with a time-base code, not a number. Declare a TIME tag (a DInt of milliseconds) in a global DB, let the HMI write that tag, and convert it to S5TIME with T_CONV before the timer's preset input. S5TIME needs a word address such as MW20, not MD20.

    HMI and touchscreens

Why KTP400 Basic panels use Time Shift instead of a timezone