DTBCD to DATE_AND_TIME
DTBCD_TO_DT converts a value of the data type DTBCD to a value of the data type DATE_AND_TIME.
Input
date and time in BCD format
Output
date and time
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
bStart: BOOL:=FALSE;
DT_value: DATE_AND_TIME;
DTBCD_value: DTBCD:=MinSec := 16#0000,
DayHour := 16#1012,
YearMonth := 16#1310;
END_VAR
When the variable bStart is set to TRUE, the function is carried out.
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_DTBCD_TO_DT!,,13,1,21,5,,?DEN?D?AENO?C);
B(B_VARIN,,DTBCD_value,11,3,13,5,);
B(B_VAROUT,,DT_value,21,3,23,5,);
B(B_CONTACT,,bStart,4,2,6,4,);
L(1,3,4,3);
L(6,3,13,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF bStart then
DT_value := DTBCD_TO_DT(DTBCD_value);
END_IF;