EcoStruxure Machine Expert version 1.1 does not support the M258, LMC058 and LMC078 controllers.

Get the Controller Date and Time

Overview

To get the RTC of the controller in a structured and ergonomic format, you have to use 2 different functions.

1.Read the RTC, using the functions SysTimeRtcGet or SysTimeRtcHighResGet.

2.Convert the time stamp in UNIX format to the SYSTIMEDATE format with the use of the function SysTimeRtcConvertUtcToDate or SysTimeRtcConvertHighResToDate.

NOTE: Due to the fact that only the UTC (Coordinated Universal Time) time is globally unique, on most systems only the UTC time is stored and processed.

Principle Diagram - Get the RTC of the Controller in Standard Resolution

G-SE-0003908.3.gif-high.gif

 

 

Example

This program example can be used to get the controller date and time.

Variable declaration:

VAR

      uidResultRtcGet: UDINT

      stGetDate: SysTimeRtc.RTS_SYSTIMEDATE;

      uiGetYear: UINT;

      uiGetMonth: UINT;

      uiGetDay: UINT;

      uiGetHour: UINT;

      uiGetMinute: UINT;

      uiGetSecond: UINT;

      uiGetMSecond: UINT;

      uiGetDayOfWeek: UINT;

      uiGetYday: UINT;

      uidResultConvertToDate: UDINT;

END_VAR

POU program:

G-SE-0003929.3.gif-high.gif

 

1   Get the RTC of the controller as time stamp value.

2   Convert the time stamp value in SYSTIMEDATE format.