Divide TIME by REAL
DIV_TIME_REAL divides the value of the first input variable of the data type TIME by the value of the second input variable of the data type REAL. The REAL value is rounded off to the nearest whole number. The result is written 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
input_time: TIME:=T#10s;
input_real: REAL:=2.4;
div_result: TIME:=T#0s;
END_VAR
The value of variable input_time is divided by the value of the variable input_real. The result is written in div_result. In this example the input variables have been declared in the POU header. However, you may enter constants directly at the contact pins of the function.
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_REAL!,Instance,9,0,18,4,,?D@'Time'?D@'Real'?C);
B(B_VARIN,,input_time,7,1,9,3,);
B(B_VARIN,,input_real,7,2,9,4,);
B(B_VAROUT,,div_result,18,1,20,3,);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
div_result:=DIV_TIME_REAL(input_time, input_real);