3/9/2011 6:05 PM | |
Posts: 947 Rating:
|
With SFC 1 "READ_CLK" (read system clock), you read the current date or current time of the system clock of the CPU. |
3/9/2011 9:25 PM | |
Joined: 1/28/2009 Last visit: 9/25/2023 Posts: 6822 Rating:
|
[code] CALL "READ_CLK" RET_VAL:=MW0 CDT :=#test CALL "DT_DATE" IN :=#test RET_VAL:=MW4 CALL "DT_TOD" IN :=#test RET_VAL:=MD8 CALL "DT_DAY" IN :=#test RET_VAL:=MW12 L MD 8 L TOD#20:49:20.000 >D S Q 0.0[/code] AttachmentSAMPLE.zip (712 Downloads) |
3/10/2011 6:05 AM | |
Joined: 1/28/2009 Last visit: 9/25/2023 Posts: 6822 Rating:
|
TIME OF DAY needs a double word.It shows the milliseconds since the start of day.See the following calculation.You can do all these calculation in you HMI and just finally transfer a double word to PLC. The point of TOD is to count how much millisecond elapsed from 0:00 till the specified time in day. 23 hours= 82800s 59 minutes=3540 s 59 seconds=59 seconds total=86399000 milli seconds TOD#23:59:59.999 equals 86399999 milli seconds TOD#23:59:59.999 ~05265BFF HEX~ 86399999 decimal If your WINCC knowledge is good and you are using WINCC check the following solution: How can you have a tag of the S7 data type IEC time (TIME) displayed in WinCC? If you are not familliar with C script in WINCC or you may humble text panels, The easiest way is to define 3 bytes to represent hour,minute and second.These values set individually and in PLC you calculate TOD based on them.The following codes are written in STL,you can convert them easily to LAD. [code] L #HOUR L 3600 *I T #TOTAL //TOD DOUBLEWORD NOP 0 L #MIN L 60 *I L #SEC +I L #TOTAL +D T #TOTAL // TIME OF DAY FROM HMI UP TO SECOND PRECISE[/code] BR |
6/14/2015 12:47 PM | |
Posts: 1 Rating:
|
Remove millisecond first, then "==D" works fine ! L MD8 |
This contribution was helpful to
2 thankful Users |
Follow us on