Split TIME into INT values
SPLIT_TIME_INT splits a value of the data type TIME into INTvalues for days, hours, minutes, seconds, and milliseconds.
Input
time
Output
1st output: days
2nd output: hours
3rd output: minutes
4th output: seconds
5th output: milliseconds
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
TIME_value: TIME:=T#234d15h58m57s890ms;
DAYS_value: INT:=0;
HOURS_value: INT:=0;
MINUTES_value: INT:=0;
SECONDS_value: INT:=0;
MILLISECONDS_value: INT:=0;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_VARIN,,TIME_value,13,1,15,3,);
B(B_VAROUT,,DAYS_value,25,1,27,3,);
B(B_VAROUT,,HOURS_value,25,2,27,4,);
B(B_VAROUT,,MINUTES_value,25,3,27,5,);
B(B_F,SPLIT_TIME_INT!,Instance,15,0,25,7,,?DIN?CDAYS?CHOURS?CMINUTES?CSECONDS?CMILLISECONDS);
B(B_VAROUT,,SECONDS_value,25,4,27,6,);
B(B_VAROUT,,MILLISECONDS_value,25,5,27,7,);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
END_BODY
SPLIT_TIME_INT(IN := TIME_value,
DAYS => DAYS_value,
HOURS => HOURS_value,
MINUTES => MINUTES_value,
SECONDS => SECONDS_value,
MILLISECONDS => MILLISECONDS_value);