9/23/2011 12:18 PM | |
Joined: 12/2/2010 Last visit: 4/2/2024 Posts: 61 Rating:
|
*******************READING PLC TIME USING SFC1************ CALL "READ_CLK"(SFC 1) RET_VAL:=#RETVALUE \\Byte CDT:=#CDT \\Date_And_Time *************************** Extracting in Words************************ LAR1 P##CDT \\Load Address register from Accumalator 1 L B [AR1, P#0.0] T #YEAR \\Word L B [AR1, P#1.0] T #MONTH \\Word L B [AR1, P#2.0] T #DATES \\Word L B [AR1, P#3.0] T #HOURS \\Word L B [AR1, P#4.0] T #MINS\\Word L B [AR1, P#5.0] T #SECS\\Word L B [AR1, P#6.0] T #MSECS\\Word L B [AR1, P#7.0] T #DATEOFWEEK\\Word **********************CONVERTING INTO INTEGER************* L YEAR\\WORD BTI LCURRENT_YEAR \\INT **************************COMPARE********************************** L CURRENT_YEAR L 11 ==I = m 2.0 ************************************************************************************** |
Regards \ Sankar |
|
9/27/2011 11:30 AM | |
Joined: 10/10/2005 Last visit: 8/29/2024 Posts: 1917 Rating:
|
Hello, the type of data by the variables YEAR, MONTH, DATES, ... should also be Byte. In your commend you have described "\\Word". Please see also the FAQ (link): http://support.automation.siemens.com/WW/view/de/22819915 With best regards |
Follow us on