← All exercises

Run Hours

medium

Accumulate the run time of a BOOL input in seconds with a manual reset.

What it teaches

Accumulate elapsed time while an input stays on, hold the running total when it drops, and clear it on reset. Teaches retentive timing, accumulating elapsed seconds across scans, and reset semantics — the basis of any run-hour or duty-cycle meter.

Inputs and outputs

TagTypeDefaultDescription
In_RunBOOLSignal to track run time
In_ResetBOOLResets the accumulated time to 0
Out_RunSecondsDINTTotal accumulated run time in seconds

Required behavior

  • Accumulates elapsed time in seconds while In_Run is true.
  • Retains the accumulated time when In_Run goes false.
  • Resets the accumulated time to 0 when In_Reset is true.