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