Subtract TIME
SUB_TIME subtracts the value of the second input variable from the value of the first input variable and writes the result into the output variable.
Input
1st input: minuend
2nd input: subtrahend
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
minuend: TIME:=T#0s;
subtrahend: TIME:=T#0s;
result: TIME:=T#0s;
END_VAR
In this example the input variables (minuend and subtrahend) have been declared. Instead, you may enter constants directly at the input contacts of a function.
Subtrahend is subtracted from minuend. The result will be written into result.
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_VARIN,,minuend,5,1,7,3,);
B(B_VARIN,,subtrahend,5,2,7,4,);
B(B_VAROUT,,result,13,1,15,3,);
B(B_F,SUB_TIME!,Instance,7,0,13,4,,?DTime1?DTime2?C);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
result:= SUB_TIME(minuend, subtrahend);
LD |
minuend |
SUB_TIME |
subtrahend |
ST |
result |