Read the real-time clock
GET_RTC_DT reads the PLC's real-time clock value 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.
Output
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#2001-01-01-00:00:00;
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,GET_RTC_DT!,Instance,19,2,27,4,,?C);
B(B_VAROUT,,DT_value,27,2,29,4,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
DT_value := GET_RTC_DT();