Divide TIME by DOUBLE INTEGER
DIV_TIME_DINT divides the value of the first input variable by the value of the second and writes the result into the output variable.
Input
1st input: dividend
2nd input: divisor
Output
result
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_1: TIME:=T#2h;
time_value_2: TIME:=T#0s;
DINT_value: DINT:=6;
END_VAR
In this example, the input variables time_value_1, DINT_value have been declared. However, you can write a constant directly at the input contact of the function instead.
time_value_1 is divided by DINT_value. The result is written in time_value_2.
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,DIV_TIME_DINT!,Instance,9,0,17,4,,?D@'Time'?D@'DInt'?C);
B(B_VARIN,,time_value_1,7,1,9,3,);
B(B_VARIN,,DINT_value,7,2,9,4,);
B(B_VAROUT,,time_value_2,17,1,19,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
time_value_2:=DIV_TIME_DINT(time_value_1, DINT_value);