System Clock PLC M340 - Unity Pro

at 730 AM %SW51 would be
0000 0111 0011 0000 which is 16#0730 or 1840 as an int. if you feed that through BCD_to_INT you will get 730 in an INT.

Don't know where you are getting 2DA from, but that isn't a value that SW51 should ever read. SW51 should only ever read 0000 to 2359 in hex or 0 to 9049 as an integer.
 
at 730 AM %SW51 would be
0000 0111 0011 0000 which is 16#0730 or 1840 as an int. if you feed that through BCD_to_INT you will get 730 in an INT.

Don't know where you are getting 2DA from, but that isn't a value that SW51 should ever read. SW51 should only ever read 0000 to 2359 in hex or 0 to 9049 as an integer.
Oh...So, that means my BCD_to_INT block is correct, it's just that my hexadecimal value from the first attach file is incorrect.
 
Hello again, first of all i'd like to thank you all for the help you provided regarding my problem a few months ago.
Now here comes another situation related to the clock in M340.
I need to sincronyze the clock on 2 M340 communicated via ethernet. The catch is that i dont have internet acces, so the R_NTPC function wont help. Is there any way i can configure one of the PLC to act as a NTP server so i can use that block? I dont think that's possible, but the only other way that comes to mind would be using READ_VAR/WRITE_VAR, writing the code from scratch, witch would take some time. Any ideas? Regards..
 
Can you move computer time to %MW-area somehow? (is there scada or something else)
Then with some time interval move this time to system words on PLC?

Between two PLC you can use io scanning or Global data setup if you need change data between them.

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

there is also system registry tweak for NTP, but I have never used or tryed...


Warning: link goes to Siemens site ;)

http://support.automation.siemens.c...lib.csinfo&lang=en&objid=22144502&caller=view
 
Have you got any pcs on your network that can act as a NTP server, if so then you can use the NTP service on the ethernet port.
In Unity 8 you can set the plc to be an NTP server - just not sure if this only works on the new M580
 
By the way, do you have noe ethernet card or M340 with embedded ethernet port on rack?
M340 with built in ethernet not have NTP function but noe cards have, if I remember it correct.
 
actually, i have a M340 with built in etherner, and i think you are right, so i cant use the NTP function, and i cant use the IO scanning (wich would make it very simple). I guess i'll have to use READ_VAR periodically to get this data. I could use the SCADA (Vijeo Citect) as the middle-man to transfer the data, but im not sure that would be reliable. I dont use the computer time directly because the PLC is way more trustworthy than the PC. (the PLC tells the SCADA the time)
 
There is a function in Citect to time sync with an NTP server. This may give you another option. I think it loads as a service on the pc. If interested you should be able to find it in the Citect help. If you cant find it, just let us know and I will have a look for you.
 
at 730 AM %SW51 would be
0000 0111 0011 0000 which is 16#0730 or 1840 as an int. if you feed that through BCD_to_INT you will get 730 in an INT.

Don't know where you are getting 2DA from, but that isn't a value that SW51 should ever read. SW51 should only ever read 0000 to 2359 in hex or 0 to 9049 as an integer.
Hello everyone,

Just one last thing, how can I set bit %S50 to 0.

As of now, %SW51 displays 0.

Please respond this post as soon as possible.

Thank you, Nemic.
 
Last edited:
Hello everyone,

Just one last thing, how can I set bit %S50 to 0.

As of now, %SW51 displays 0.

Please respond this post as soon as possible.

Thank you, Nemic.

1. Set bit %S50 to 1. (set block with show enable pin or move block with some bit variable)
2. Write BCD value 0 to %SW50, (by the way integer 0 and BCD are both 0), so you can use move or int_to_bcd blcok)
3. reset bit %S50. (reset block with show enable pin)

Same also for all other clock words, but remeber change integer values to BCD format befere moving to %SW50-54 system word.
 
Last edited:
1. Set bit %S50 to 1. (set block with show enable pin or move block with some bit variable)
2. Write BCD value 0 to %SW50, (by the way integer 0 and BCD are both 0), so you can use move or int_to_bcd blcok)
3. reset bit %S50. (reset block with show enable pin)

Same also for all other clock words, but remeber change integer values to BCD format befere moving to %SW50-54 system word.
What kind of block, Lare?
 
No, you want now reset or set %S50 bit, so it have to be on output side and to input pin you connect something else. Unity PLC clock is running when %S50 bit is zero, new time can be adjusted, when %S50 bit is "1" and new time is taked to use at transition "1"->"0".

If you want to use different buttons/bits to setting %s50 bit then use set and reset blocks. If you use same variable for setting and resetting %s50 bit then you can use move block.

You also need adjust years, days and months, on example only seconds and hours and minutes are adjusted ;)

clock.jpg
 
No, you want now reset or set %S50 bit, so it have to be on output side and to input pin you connect something else. Unity PLC clock is running when %S50 bit is zero, new time can be adjusted, when %S50 bit is "1" and new time is taked to use at transition "1"->"0".

If you want to use different buttons/bits to setting %s50 bit then use set and reset blocks. If you use same variable for setting and resetting %s50 bit then you can use move block.

You also need adjust years, days and months, on example only seconds and hours and minutes are adjusted ;)
Wow, that's amazing.

What type set_clock is?

...
 
Last edited:

Similar Topics

I am using a Studio 5000 with an Allen Bradley CompactLogix 1769-L24ER-QB1B controller. Im wondering how I can use the system clock to be able to...
Replies
10
Views
2,426
HEllo! Where do it setup the clock? Couldn´t find anything useful in General-->Time of day besides daylight saving time. And when i have set the...
Replies
9
Views
1,300
Hello everyone one. I'm using M340 with simulation mode (actually I still don't have the cpu to test the software). I've made a simple counter...
Replies
4
Views
502
I took an online course but don't remember covering this. How do I access the system clock in a compare instruction? I want to turn on an output...
Replies
1
Views
514
hello everyone, I'm trying to set the system clock on my plc for daylight savings time so the operator does not need to adjust himself twice a...
Replies
1
Views
2,421
Back
Top Bottom