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

Set the Controller Date and Time

Overview

To set the RTC of the controller based on a structured and ergonomic format, you have to use 2 different functions.

1.Convert the SYSTIMEDATE format to the time stamp in UNIX format with the use of the function SysTimeRtcConvertDateToUtc or SysTimeRtcConvertDateToHighRes.

2.Write the RTC, using the functions SysTimeRtcSet or SysTimeRtcHighResSet.

NOTE: Some controllers support a function for a weekly automatic correction of the real time clock. The name of this function is SetRTCDrift. The use of this function could be an alternative to using the SysTimeRtcSet function for the continuously readjustment of the RTC. Refer to the PLCSystem Library Guide of your controller to verify whether the function is supported and to get further information about this function.

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 - Set the RTC of the Controller in Standard Resolution

G-SE-0003907.3.gif-high.gif

 

 

Example

This program example can be used to set the controller real time clock with a user date and time.

Variable declaration:

VAR

      uiSetYear: UINT;

      uiSetMonth: UINT;

      uiSetDay: UINT;

      uiSetHour: UINT;

      uiSetMinute: UINT;

      uiSetSecond: UINT;

      uiSetMSecond: UINT

      udiResultConvertToUtc: UDINT;

      dwSetTimeStamp: DWORD;

      xCommandSetRtc: BOOL;

      uidResultRtcSet: UDINT;

END_VAR

POU program:

G-SE-0003930.3.gif-high.gif

 

1   Assign the date and time parameter to the structure.

2   Convert the SYSTIMEDATE format to a time stamp value.

3   Set the controller RTC with new time stamp if xCommandSetRtc = TRUE and conversion was successful.