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
ETat or pastPTgives 0.- A
PTof 0 or less gives 0. A negativeETcounts as 0, so the result is never more thanPT. - Show it on an HMI with UT_TIME_SPLIT for days, hours, minutes and seconds.
Last updated 2 hours ago
Was this helpful?