4. Configuration
180
Figure 4-84. SetDateAndTime
This variable, when receives a rising edge,
enables the clock writing.
Receives the values of date and hour with
milliseconds. See section
EXTENDED_DATE_AND_TIME
Table 4-119. Input Parameters of SetDateAndTime
This variable, when true, indicates that the
action was successfully completed.
This variable, when true, indicates that the
function is processing the values.
This variable, when true, indicates an error
during the Reading/Writing.
Returns the error occurred during the
reading/configuration. See section RTC Data
Structures - RTC_STATUS.
Table 4-120. Output Parameters of SetDateAndTime
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 MainPrg
VAR
SetDateAndTime : SetDateAndTime;
xRequest : BOOL;
DateAndTime : EXTENDED_DATE_AND_TIME;
xDone : BOOL;
xExec : BOOL;
xError : BOOL;
Status : RTC_STATUS;
xWrite : BOOL;
END_VAR
--------------------------------------------------------------------------
IF (xWrite = TRUE) THEN
SetDateAndTime(
request := xRequest,
done => xDone,
exec => xExec,
error => xError,
status => status,
DateAndTime := DateAndTime);
xWrite := FALSE;
END_IF