Divide TIME by INTEGER
DIV_TIME_INT divides the value of the first input variable by the value of the second input variable 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#0s;
time_value_2: TIME:=T#0s;
INT_value: INT:=0;
END_VAR
In this example the input variables time_value_1 and INT_value have been declared. Instead, you may enter constants directly at the input contacts of a function.
time_value_1 is divided by INT_value. The result is written into 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_INT!,Instance,9,0,17,4,,?D@'Time'?D@'Int'?C);
B(B_VARIN,,time_value_1,7,1,9,3,);
B(B_VARIN,,INT_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_INT(time_value_1, INT_value);
LD |
time_value_1 |
DIV_TIME_INT |
INT_value |
ST |
time_value_2 |