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.
| Language | structured text |
|---|---|
| Code | RTC |
| Group | Function block |
| Syntax | RTC(EN:=VarBOOL1, PDT:=DT#2006-03-30-14:00:00, Q=>VarBOOL2, CDT=>VarTimeCur); |
| Dialect |
| Name | Data type | Description |
|---|---|---|
| EN | BOOL | Rising edge: CDT is set to PDT and CDT starts increasing. Falling edge: CDT is set to DT#1970-01-01-00:00:00. |
| PDT | DT | Preset date and time |
| Q | BOOL | TRUE as long as CDT is counting |
| CDT | DT | Date and time, elapsed since PDT |