Extended Instructions; Date, Time-Of-Day, And Clock Functions; Date And Time-Of-Day Instructions - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Extended instructions

8.1

Date, time-of-day, and clock functions

8.1.1

Date and time-of-day instructions

Use the date and time instructions for calendar and time calculations.
● T_CONV converts a value to or from (date and time data types) and (byte, word, and
● T_ADD adds Time and DTL values: (Time + Time = Time) or (DTL + Time = DTL)
● T_SUB subtracts Time and DTL values: (Time - Time = Time) or (DTL - Time = DTL)
● T_DIFF provides the difference between two DTL values as a Time value: DTL - DTL =
● T_COMBINE combines a Date value and a Time_and_Date value to create a DTL value
For information about the format of DTL and Time data, refer to the section on the Time and
Date data types (Page 113).
Table 8- 1
T_CONV (Convert times and extract) instruction
LAD / FBD
SCL example
out := DINT_TO_TIME(
in:=_variant_in);
out := TIME_TO_DINT(
in:=_variant_in);
For LAD and FBD boxes: Click "???" and select the source/target data types from the drop-down menu.
1
For SCL: Drag T_CONV from instruction tree and drop into the program editor, then select the source/target data types.
2
Table 8- 2
Valid data types for T_CONV conversions
Data type IN (or OUT)
TIME (milliseconds)
DATE (number of days since Jan. 1 1990)
TOD (milliseconds since midnight- 24:00:00.000)
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
dword size data types)
Time
Description
T_CONV converts a value to or from (date and time data types) and
(byte, word, and dword size data types).
Data types OUT (or IN)
DInt, Int, SInt, UDInt, UInt, USInt, TOD
SCL only: Byte, Word, Dword
DInt, Int, SInt, UDInt, UInt, USInt, DTL
SCL only: Byte, Word, Dword
DInt, Int, SInt, UDInt, UInt, USInt, TIME, DTL
SCL only: Byte, Word, Dword
8
283

Advertisement

Table of Contents
loading

Table of Contents