SUB_TIME

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.

Parameters

Input

Time1 (TIME)

1st input: minuend

Time2 (TIME)

2nd input: subtrahend

Output

Time1 (TIME)

Result

Example

POU header

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.

POU body

Subtrahend is subtracted from minuend. The result will be written into result.

LD body

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

ST body

result:= SUB_TIME(minuend, subtrahend);

IL body

LD

minuend

SUB_TIME

subtrahend

ST

result

Modified on: 2019-01-26Feedback on this pagePanasonic hotline