Daylight Saving with M340

cntrlz

Member
Join Date
Dec 2009
Location
Cornwall
Posts
4
Hi, am trying to write to the system clock using UnityProS and M340 to change to NZ daylight saving automatically, I have done the same on Siemens PLC's but not with Schneider - I have read up on the system words %S49 - 53 but I am struggling to read the actual Month - the word being Month/Date, I have tried to convert using WORD_AS_BYTE but it says the %SW is an INT?? Can anyone shine some light on this for me please?
Any help would be most appreciated.
 
hi, take a look to thread, there is basic method how you can set and read Unity's PLC time, I posted it last week

http://www.plctalk.net/qanda/showthread.php?t=51729

if you want read actual month and day to seperate variables, you have to use shl (shift right) command after you have readed plc system word %sw52 to int variable with BCD_TO_INT command.

And of course, when you set time to PLC and want use seperate int variables for month and day, you have to use first shl command (shift left) and after that you have to add day variable to it, so that you get month and day to same system variable again...

Lare
 
Oops. I writed it wrong before, you have to use shl and shr commands first and after that you can use bcd to int and int to bcd conversions...


Lare
 
Hi Lare,
Got your first email as I went to site, so had a go - got your second email when I got back home - will go back next week and have another try. Thank you very much for the help it is most appreciated.
Have a nice Christmas :)
 
Minutes in Unity

I am having the same issue as I require the minutes to be separated from the hours. When I use the BCD_TO_INT I get the hours and minutes as an INT. I have tried the ROR function before using the BCD_TO_INT but it just switches the order. Can you please tell me how you were able to use the rotate right in order to read the minutes separately?

Thanks
 
Does the M340 have a mask? In Omron PLCs I use ANDW (and word).
As follows ANDW #FF00 A352 D1000 lets hours through but blocks the upper byte. If you want the upper byte then ANDW #00FF A352 D1000 then SWAP D1000 to swap the upper and lower bytes. Find this the easiest way bt far.
 
you need Shift command (SHR and SHL) instead of ROR.
Another method is dividing by 100 to get hours.
Minutes are HHMM - hours*100
 
Does the M340 have a mask? In Omron PLCs I use ANDW (and word).
As follows ANDW #FF00 A352 D1000 lets hours through but blocks the upper byte. If you want the upper byte then ANDW #00FF A352 D1000 then SWAP D1000 to swap the upper and lower bytes. Find this the easiest way bt far.

Yes Bob simply use the AND instruction (the input and output data types may be BOOL, BYTE, WORD, DWORD) or use the AND_ARxxxx functions (where xxxx may be EBOOL, WORD, DWORD) to AND two arrays.
 

Similar Topics

How to change Daylight saving time ON/OFF automatically in Crimson3.0&3.1/Redlion HMI How to change Daylight saving time ON/OFF automatically in...
Replies
5
Views
2,175
Hello guys i have a big problem with the datalog in FTV-SE (v10). How do you guys manage the daylight saving time (summer time) change? For the...
Replies
15
Views
7,229
Everybody prepared for the Extended daylight saving here the news from rockwell http://www.ab.com/news/daylightsavings.html
Replies
0
Views
2,176
HI, I need to automatically update the RTC on an FX1 for daylight saving - has anyone any code that will do this simply? Nigel
Replies
0
Views
3,642
Now that the new energy bill has been signed and Daylight Saving Time has a new start and end next year, who will be having to revise programs...
Replies
26
Views
6,130
Back
Top Bottom