RTC

RTC is a function block that calculates elapsed time since a given start time. On a rising edge of EN, CDT is set to PDT and starts increasing; on a falling edge, CDT is set to DT#1970-01-01-00:00:00. It can also return the current date and time by setting PDT to the current local time on the rising edge of EN.

Source checked15/15 values · 2026-10-26

Specification

1 source
Languagestructured text
CodeRTC
GroupFunction block
SyntaxRTC(EN:=VarBOOL1, PDT:=DT#2006-03-30-14:00:00, Q=>VarBOOL2, CDT=>VarTimeCur);
Dialect

Parameters

NameData typeDescription
ENBOOLRising edge: CDT is set to PDT and CDT starts increasing. Falling edge: CDT is set to DT#1970-01-01-00:00:00.
PDTDTPreset date and time
QBOOLTRUE as long as CDT is counting
CDTDTDate and time, elapsed since PDT

Study notes

  • With PDT set to DT#1970-01-01-00:00:00 or left unconnected, RTC can be used as an operation hour counter.
  • To return the current date and time, set PDT to the current local time on the rising edge of EN.

Safety

  • The counter overflows on 7 February 2106.
↑↓ navigate↵ openesc close