Set the real-time clock
SET_RTC_DT sets the real-time clock value in the PLC for the clock/calendar function. If the PLC has no real-time clock or if the real-time clock is not functioning, the result is an invalid date and time value.
From version 6.42 onwards, this function implicitely sets the day of week with the function DAY_OF_WEEK0, i.e. 0 corresponds to Sunday, 6 to Saturday.
Input
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bSetEdge: BOOL:=FALSE;
DT_value: DT:=DT#2010-06-30-11:15:00;
bEno: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 5 ;
NETWORK_BODY
B(B_F,E_SET_RTC_DT!,Instance,20,1,28,5,,?DEN?DIN?AENO);
B(B_VARIN,,DT_value,18,3,20,5,);
B(B_CONTACT,,bSetEdge,7,2,9,4,R);
B(B_COIL,,bEno,37,2,39,4,);
L(1,3,7,3);
L(9,3,20,3);
L(28,3,37,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(bSetEdge) then
SET_RTC_DT(DT_value);
END_IF;