101BExtended instructions
8.1 Date and time-of-day
S7-1200 Programmable controller
234
System Manual, 11/2011, A5E02486680-05
Table 8- 3
T_ADD (Time Add) and T_SUB (Time Subtract) instructions
LAD / FBD
SCL
Description
out := T_ADD(
in1:=_variant_in,
in2:=_time_in);
T_ADD adds the input IN1 value (DTL or Time data types) with the input
IN2 Time value. Parameter OUT provides the DTL or Time value result.
Two data type operations are possible:
Time + Time = Time
DTL + Time = DTL
out := T_SUB(
in1:=_variant_in,
in2:=_time_in);
T_SUB subtracts the IN2 Time value from IN1 (DTL or Time value).
Parameter OUT provides the difference value as a DTL or Time data
type. Two data type operations are possible:
Time - Time = Time
DTL - Time = DTL
1
For LAD and FBD: Click the "???" and select the data types from the drop-down menu.
Table 8- 4
Data types for the T_ADD and T_SUB parameters
Parameter and type
Data type
Description
IN1
1
IN
DTL, Time
DTL or Time value
IN2
IN
Time
Time value to add or subtract
OUT
OUT
DTL, Time
DTL or Time sum or difference
1
Select the IN1 data type from the drop-down list available below the instruction name. The IN1 data type selection also
sets the data type of parameter OUT.
Table 8- 5
T_DIFF (Time Difference) instruction
LAD / FBD
SCL
Description
out := T_DIFF(
in1:=_DTL_in,
in2:=_DTL_in);
T_DIFF subtracts the DTL value (IN2) from the DTL value (IN1).
Parameter OUT provides the difference value as a Time data type.
DTL - DTL = Time
Table 8- 6
Data types for the T_DIFF parameters
Parameter and type
Data type
Description
IN1
IN
DTL
DTL value
IN2
IN
DTL
DTL value to subtract
OUT
OUT
Time
Time difference