(2)| 4/19/2010 4:05 AM | |
|
Posts: 43 Rating:
|
I am trying to extract the current HOUR from the current Time. Is there a system function for doing this? |
| 4/19/2010 5:18 AM | |
|
Joined: 3/21/2006 Last visit: 1/10/2026 Posts: 10247 Rating:
|
Hello, Look at FAQ:How can you read out the date and time with SFC1 (READ_CLK) and input them with SFC0 (SET_CLK)? Best regards, Hristo Mihalev |
| 4/19/2010 5:30 AM | |
|
Joined: 10/7/2005 Last visit: 1/16/2026 Posts: 3054 Rating:
|
Hello cbcX in what format (data type) isyour "current Time"? If it is "Date_And_Time" format than you'll find the hour value in the fourth Byteof it (NOTE: in BCD format, search Step 7's inbuilt help for more on the "makeup" of the Date_And_Time format). If it is in "TOD" (Time of Day) format, then the value is simply an unsigned integer number in milliseconds, with zero equal to midnight. If you do a DINT divisionof the TOD value by 3600000 (ms), you'll get the quotient which is the hour value. There are also a number of Functions available in the "IEC Function Blocks" library to "handle" Date_And_Time variables (e.g. rather than using the fourth byte to get the hour you could use FC 8 "DT_TOD" to extract TODand divide the resultby 3600000 to get the hour). I hope this helps |
|
Cheers |
|
This contribution was helpful to
|
|
Follow us on