Siemens S7/TIA v18: Wall-clock time and PLC battery life......

Mas01

Member
Join Date
Oct 2020
Location
Leicester, England
Posts
1,109
At the moment on my application (S7-1212C), the PLC/HMI are showing the correct time, i.e. the displayed time matches the time of the clock on the wall.

Someone's asked me, "What if the PLC is not used for a while, has been unplugged and put in a store room for x months, and in that time the PLC battery goes flat. What will the PLC time be when it's next powered up?"

That question has thrown me... Does anyone know the answer to this?

Thanks
 
I don't actually know the time for 1200's, but there is a defined time that it will default to. I think 1500s go back to jan 1 2010.



put in a store room for x months, and in that time the PLC battery goes flat


You CAN give it a battery backup (up to 1 year) via a special signal board, but otherwise the clock capacitor inside lasts just a week or two, FYI.
 
Based on the LDT data type, it looks like the "zero" time for the clock is no later than 1970-Jan-01T00:00:00, probably UTC.

Other date and time data types suggest the same, or 1990-Jan-01, but I suspect those are derived from the LDT, which is basically a nanosecond counter.

If we assume that 16@7FFF_FFFF_FFFF_FFFF (~9e18) is nanoseconds, that is 9e9 seconds, at π x 107 seconds per year that comes out to 290+y, so and 1970 + 290+ => 2260+y, which is the upper limit in the image below.

My assumption is that, if an S7-1200 lost line as well as battery power to the clock, then the clock would reset to 0ns relative to its zero time, so I think the answer to @Mas01's query is the start of 1970.
Untitled.png
 
You CAN give it a battery backup (up to 1 year) via a special signal board, but otherwise the clock capacitor inside lasts just a week or two, FYI.
The on-paper rating is "typically 20 days / minimum 12 days at 40°C" unplugged.
 
Last edited:
Many thanks for the replies!
I'm surprised the battery will be flat in 20 days...it is what it is, I suppose...I was hoping it'd be more like 6 months LOL.

I'll do some research into this signal board mentioned by @mk42, see if it's worth buying. Or maybe get the customer to switch the PLC on once a week or something just to top up the battery!
Cheers
 
I am not well versed in Siemens gear, but I always put the HMI time in the corner and when you touch it, the page is changed to one that gives the operator access to set the HMI and/or PLC clock times manually.

If you build this into your application, then you don't have to worry about clock drift, daylight savings laws, etc.
 
I am not well versed in Siemens gear, but I always put the HMI time in the corner and when you touch it, the page is changed to one that gives the operator access to set the HMI and/or PLC clock times manually.

If you build this into your application, then you don't have to worry about clock drift, daylight savings laws, etc.
Good shout, OkiePC... Intuitively, this must also be possible in Siemens S7-1200... somehow.
 
The on-paper rating is "typically 20 days / minimum 12 days at 40°C" unplugged.

I imagine that's just the PLC on it's own. I think what mk42 meant was that you can buy a battery module to extend this to a year.

https://www.parmley-graham.co.uk/au.../s7-1200-basic-controllers/6ES7297-0AX30-0XA0

Good shout, OkiePC... Intuitively, this must also be possible in Siemens S7-1200... somehow.

It is! You can write the local time pretty easily. The date though, the date had me pulling my hair out. It was only a minor thing so I decided to just let it go but I never managed to figure out how to write the date from the HMI.

I think the way to do it was through the HMI job mailbox (Connections > Area Pointer tab) but it's not something I'd used before. Now I've remembered that I couldn't do it I know it's going to bother me too!
 
Last edited:
I would let the HMI be the master for the PLC.
Time synchronization between WinCC and a SIMATIC PLC
Notice for S7-1200/1500 there are system functions to sync the clock without having to code anything.

That being said, the Siemens HMIs also have a supercapacitor for the internal clock, so it also only lasts for a limited time if powered off.
I suggest make an alarm 'Clock needs to be set' and let the trigger be if the Year is < 2023.
When the operator then sets the HMI clock, the PLC clock will be set as well.
 
Thanks for all the help!

Based on the replies, I see there's an instruction block called WR_LOC_T (write local time) which will allow the user to set the date and time.

The time is now set by the HMI - per @JesperMP's comment.

It seems to be working fine (famous last words).

WR_LOC_T.png
 
Last edited:

Similar Topics

Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi again, When the "REPORT" button is pressed (on a different screen), it takes the operator to the...
Replies
7
Views
669
Context: PLC= S7-1212C, HMI=KTP1200 Basic. Hi, The operator has reported that, from time-to-time, when he presses the "Generate Report" button...
Replies
5
Views
466
General Question: The PLC and HMI that I've been working on (a laser measurement system) is soon to be transported to the site where it will be...
Replies
2
Views
701
Hi, I'm not sure how to do this... Basically, I want to restrict the user input values for this tag to be in the range 20.001 to 25.0. I...
Replies
17
Views
1,636
Can someone help me with this? I'm no good at SCL - virtually everything I've done so far has been ladder logic. The return value from the...
Replies
13
Views
1,109
Back
Top Bottom