Micrologix 1400 RTC Conversion/Comparison

dday76

Member
Join Date
Jul 2013
Location
Toronto
Posts
3
Hi everyone,
I’ve been reading these boards for some time and have had many questions answered indirectly by the helpful members of this forum.
I need to implement a power up delay on a machine and am trying to compare the current RTC value with the value of the RTC when power was removed from the PLC. Basically the delay needs to match the amount of time the PLC has been off. The math is easy enough when it’s in the same month or year but I’m having trouble figuring out how to handle situations where the month or year has changed over.
Initially I thought about converting the RTC to minutes only and comparing those two values but I’m not sure if that will work since I’m limited to 16 bit values. I could be way off on that assumption.
Does this PLC have to ability to track time in UNIX or epoch format?
Any suggestions would be greatly appreciated.

Thank you.
 
I'm not sure if this can help you, but there is an AOI instruction for elapsed time. It's designed for control logix, but try to convert it to ML1400, it works even if year changes, what i'm not sure is about convertibility to ML1400.
You can download it from here:
http://search.rockwellautomation.com/search?q=elapsed+time+add-on+instruction&filter=0&num=20&getfields=*&client=samplecode&output=xml_no_dtd&proxystylesheet=samplecode&ulang=en&sort=date%3AD%3AL%3Ad1&entqrm=2&oe=UTF-8&ie=UTF-8&ud=1&exclude_apps=1&site=sample_code
 
Thanks widelto,

I had a look and it doesn't appear to be easily convertable. I hadn't realized the ML1400 has long word capability, I can just write some code to transfer the RTC to seconds in that case.

Thanks again.
 
I can just write some code to transfer the RTC to seconds
I'm just curious how you intend to do that? If you're crossing month boundaries then you'll have to consider the number of days in each month. And if you want to make it perfect you'll have to determine whether it's a leap year, since that affects the number of days in February. Fortunately the Micro 1400 has the CPT instruction which makes complex calculation easier. Also, how do you intend to get the RTC value at the moment the PLC is powered off? It seems to me that you would need a UPS or battery that can maintain power to the controller long enough for the value to be stored.
 
Thanks for the idea TConnolly…Sorry about the delay kolyur, I’ve been away. I’ve accounted for the days in each month. Also I was able to determine whether it was a leap year by dividing the current year by 4 and using math register S13 as the destination. The quotient ends up in S14 and the remainder is placed in S13, ie if S13 equals 0 it’s a leap year.

The battery is able to save the last recorded date, which I subtract from the current date when power is reapplied to get the difference.

Rather than plod through the entire code I’ve just posted it for you to check if you wish.

I don’t know if it’s bullet proof but so far it’s testing out ok.

[FONT=&quot]Thanks to all for your suggestions.
[/FONT]
 

Similar Topics

Hi There, We seem to be having issues with one of our MicroLogix 1400. It appears that after certain days, the RTC time automatically resets to...
Replies
6
Views
2,281
I am using Micrologix 1400 with RSLogix 500 for the first time and having some trouble using the Real Time Clock - RTC. Reading the values is no...
Replies
2
Views
4,184
I have an application where I'm trying to sync a HMI clock with the Micrologix RTC. I finally got everything working, but I found one fairly...
Replies
3
Views
4,742
Hi, Could someone please check the file attached and advice if there is any thing else to be considered? Please note I have attached only part of...
Replies
2
Views
6,718
Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
20
Back
Top Bottom