OpenPLC

OpenPLC

Open in ChatGPT
Ask ChatGPT about this page
Open in Claude
Ask Claude about this page

UT_COUNTDOWN — Remaining time (function)

UT_COUNTDOWN — Remaining time (function)

Works with any timer: the standard TON/TOF/TP, or UT_TONR. Typical use is
showing "time left" on an HMI.

Pins

Pin Type Default What to wire
in PT TIME T#0s Timer preset (MyTon.PT)
in ET TIME T#0s Timer elapsed (MyTon.ET)
returns TIME PT − ET, never negative
Remaining := UT_COUNTDOWN(PT := Delay.PT, ET := Delay.ET);

How it works

  • ET at or past PT gives 0.
  • A PT of 0 or less gives 0. A negative ET counts as 0, so the result is never more than PT.
  • Show it on an HMI with UT_TIME_SPLIT for days, hours, minutes and seconds.
Last updated 2 hours ago
Was this helpful?
Thanks!