Siemens date and time format

    Siemens S7-200/200smart series

This series of read and write instructions is very simple, you can use an instruction and fill in the address, the data has a fixed format.

    S7-300/400, S1200, S1500 series

This series of PLC date and time data types mainly includes; 1 date (date), 2 day time (Time_Of_ Day), 3 long time LTOD (LTime_Of_Day), 4 date time DT (Date_And_Time), 5 date long time LDT ( Date_And_LTime), 6 long date and time DTL.

   For Siemens S7-300/400, S1200, S1500 these data types are not universal.

We need to figure out these date formats

(1) Date DATE

Data type the data as an unsigned integer. The notation contains the year, month and day.

The data type DATE operand is located in hexadecimal form, corresponding to the date value (16#0000) since 01-01-1990. The contents of the variable are shown in integer format by the number of days from January 1, 1990. The constant format is D# before the date. For example, the date specified by D#2168 – 12-31 is December 31, 2168, and the content of the corresponding variable is W#16#FF62.

(2) Day time (Time_Of_ Day)

TOD (TIME_OF_DAY) data type occupies a double word and stores the number of milliseconds from 0:00 h of the day, which is an unsigned integer. The constant indicates that the format is TOD# before the time.

(3) Long time LTOD (LTime_Of_Day)

Long-day LTOD (LTime_Of_Day) data type occupies 2 double words and stores the number of nanoseconds from 0:00 of the day, which is an unsigned integer. Nanosecond data are only available in the S1500 series.

(4) Date time DT ( Date_And_Time)

The daytime DT (Date_And_Time) data type stores date and time information in the format BCD.

(5) Date long LDT (Date_And_LTime)

The date long LDT (Date_And_LTime) data type stores date and time information (in nanoseconds) since 0:00 on January 1, 1970.

(6) Long date and time DTL

The extended date time (DTL) data type has an operand length of 12 bytes and stores date and time information in a predefined structure.

The structure of a DTL data type has several parts, each of which contains different data types and ranges of values. The data type of the specified value must match the data type of the corresponding element. Table 5-18 shows in the structural components of the DTL data type.

Leave a Reply

Your email address will not be published. Required fields are marked *