5. CONFIGURATION
When a rising edge occurs at the REQUEST input, the function block will write the new DATEANDTIME values on the
clock. If the writing is successfully done, the DONE output will be equal to TRUE. Otherwise, the ERROR output will be equal
to TRUE and the error will appear in the STATUS variable.
Utilization example in ST language:
PROGRAM UserPrg
VAR
SetDateAndTime : SetDateAndTime;
xRequest : BOOL;
DateAndTime : EXTENDED_DATE_AND_TIME;
xDone : BOOL;
xExec : BOOL;
xError : BOOL;
xStatus : RTC_STATUS;
END_VAR
--------------------------------------------------------------------------
IF xRequest THEN
SetDateAndTime.REQUEST:=TRUE;
SetDateAndTime.DATEANDTIME:=DateAndTime;
xRequest:= FALSE;
END_IF
SetDateAndTime();
SetDateAndTime.REQUEST:=FALSE;
IF SetDateAndTime.DONE THEN
xExec:=SetDateAndTime.EXEC;
xError:=SetDateAndTime.ERROR;
xStatus:=SetDateAndTime.STATUS;
END_IF
ATTENTION
If you try to write time values outside the range of the RTC, the values are converted to
valid values, provided they do not exceed the valid range of 01/01/2000 to 12/31/2035. For
example, if the user attempts to write the value 2000 ms, it will be converted to 2 seconds,
write the value 100 seconds, it will be converted to 1 min and 40 seconds. If the type value
of 30 hours, it is converted to 1 day and 6 hours, and so on.
5.8.1.2.2. SetTimeZone
The following function block makes the writing of the time zone settings:
Figure 132: Writing of the Time zone Settings
221