DTL datatype S71200 (Time)

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Anyone who knows how to filter the Time out of the DTL datatype ?

In Simatic, this is done by a TOD library SFC... donno in portal for S71200.

Thanks,

Kind regards,
Combo
 
Hi Combo!

I don't have the TIA here, but isn't it a function called 'RD_LOC_T' (or something similar) that can be used for the purpose? Perhaps you aren't talking about the local time?

Kalle
 
In a Data Block set up a variable of type DTL, use RD_SYS_T to copy system time into that block. The DTL data type is a structure of 12 bytes:
0 & 1 : Year
2 : Month
3 : Day
4 : Day of Week
5 : Hour
6 : Minute
7 : Second
8to11 : Nanoseconds

I only use non-symbolic DBs so it is easy for me to read any byte out of the structure. If DB2.DBX6.0 was the DTL structure then DB2.DBB5 is the byte that gives the hour.
 
Thanks for your reply

I have an array of 20 type Time vars in a DB. Non-symbolic DB's because I read the data with an MP277. What I have programmed = Fifo. On a trigger I shift all 1 index further. In index 0 I want to write the current Time Of Day.

I want the Time Of Day in a var.

Kind regards,
Combo



In a Data Block set up a variable of type DTL, use RD_SYS_T to copy system time into that block. The DTL data type is a structure of 12 bytes:
0 & 1 : Year
2 : Month
3 : Day
4 : Day of Week
5 : Hour
6 : Minute
7 : Second
8to11 : Nanoseconds

I only use non-symbolic DBs so it is easy for me to read any byte out of the structure. If DB2.DBX6.0 was the DTL structure then DB2.DBB5 is the byte that gives the hour.
 
hi

Local Time indeed. But DTL format is not usable in an array, therefor I want it in a Time format...

Regards,
Combo

Hi Combo!

I don't have the TIA here, but isn't it a function called 'RD_LOC_T' (or something similar) that can be used for the purpose? Perhaps you aren't talking about the local time?

Kalle
 
T_CONV can convert Time to DI and DI to Time. NO DTL.
Sorry, I am still getting to grips with the manual. I haven't used Simatic, what format does DT_TOD return the Time Of Day?

'Time' in the S7-1200 is stored as a number of ms, so if you use my plan 'A' you extract the number of hours, minutes and seconds from a DTL structure and then do quick bit of maths to convert to ms. From there T_CONV will do the job.

If you don't want to extract the bytes then you can create a DTL structure that represents midnight at the start of a day and then T_DIF to give the 'Time' difference between a known DTL and the current DTL.

Or use a single known date in DTL format, use T_DIF the get the difference in 'Time', use T_CONV to get it in to ms (TimeRaw), use TimeRaw MOD 86400000 to get the remainder of ms and then use T_CONV.

Or you can reset a timer at midnight so than you know the number of ms in to the day and then use T_CONV.

I realise that none of this may be as simple as DT_TOD, .....but it is just a bit of maths.
 
Hi, I use the following to extract data from DTL format:

#ActualYear := BCD16_TO_INT(BYTE_TO_WORD(#ActualDateTime.YEAR));
#ActualMonth := BCD16_TO_INT(BYTE_TO_WORD(#ActualDateTime.MONTH));
#ActualDay := BCD16_TO_INT(BYTE_TO_WORD(#ActualDateTime.DAY));
#ActualHour := BCD16_TO_INT(BYTE_TO_WORD(#ActualDateTime.HOUR)) ;
#ActualMinute := BCD16_TO_INT(BYTE_TO_WORD(#ActualDateTime.MINUTE));


Ade
 

Similar Topics

Anyone know how I can convert DTL to DATE type? This rung is trying to determine if the system is in calibration by subtracting the current date...
Replies
1
Views
585
Hi; I have installed Weintek HMIs at different machines. I have configured data logging and HMI logs the data in a file having extension...
Replies
0
Views
1,295
Hi; I have installed Weintek HMIs at different machines. I have configured data logging and HMI logs the data in a file having extension...
Replies
0
Views
1,197
Hi guys I am crossing internet two days, but I can not find something really helpful for me.. I have this problem: I have to read expiration...
Replies
3
Views
11,392
Hey there, I have some issues with my code below: IF "OUT_MachineActive" = TRUE THEN //output when the machine is active "webdata".I_ReadTime...
Replies
2
Views
3,784
Back
Top Bottom