Get current time using ST Code worksheet.
Hello everyone,
How can I get the current time using ST Code worksheet?
I tried this executionTimeElapsed := TON(SysTime() - lastExecutionTime >= TIME_TO_DINT(100), executionTimeElapsed);
but SysTime() says "Parameter expected"
Thank you in advance,
DM
Comments
RTC is a global struct you can access if it is sufficient with seconds and not milliseconds.
RTC_TYPE : STRUCT
HOURS : USINT;
MINUTES : USINT;
SECONDS : USINT;
DAY : USINT;
MONTH : USINT;
YEAR : UINT;
END_STRUCT
If you need higher resolution time, you can use the FB PBCL_DateTimeGet_1 from the PLCnext Base library