EasyManua.ls Logo

Siemens SIMATIC S7-1200 - 9 Extended instructions; 9.1 Date, time-of-day, and clock functions; 9.1.1 Date and time-of-day instructions

Siemens SIMATIC S7-1200
1614 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
335
Extended instructions
9
9.1
Date, time-of-day, and clock functions
9.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
dword size data types)
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 =
Time
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 128).
Table 9- 1 T_CONV (Convert times and extract) instruction
LAD / FBD
SCL example
Description
out := DINT_TO_TIME(
in:=_variant_in);
out := TIME_TO_DINT(
in:=_variant_in);
T_CONV converts a value to or from (date and time data types) and
(byte, word, and dword size data types).
1
For LAD and FBD boxes: Click "???" and select the source/target data types from the drop-down menu.
2
For SCL: Drag T_CONV from instruction tree and drop into the program editor, then select the source/target data types.
Table 9- 2 Valid data types for T_CONV conversions
Data type IN (or OUT)
Data types OUT (or IN)
TIME (milliseconds) DInt, Int, SInt, UDInt, UInt, USInt, TOD
SCL only: Byte, Word, Dword
DATE (number of days since Jan. 1 1990) DInt, Int, SInt, UDInt, UInt, USInt, DTL
SCL only: Byte, Word, Dword
TOD (milliseconds since midnight- 24:00:00.000) DInt, Int, SInt, UDInt, UInt, USInt, TIME, DTL
SCL only: Byte, Word, Dword

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals