Help - Search - Members - Calendar
Full Version: Timers
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Brad
I want to have a clock that will reset each time a bit goes true. Trying to keep track of the last time a change is made. I have a timer set up to set off an alarm when the same change is not made. To make a long story short, I am looking for a way to have a clock give me a time in between the changes. Once I have that I can transfer that information to a monitor or spread sheet.
Spedley
You could just copy the contents of the clock S:37-S:42 when your bit goes true (with a one-shot if neccassary) and send this to the spread sheet and let the spreadsheet calculate the difference in time.

S:37 = Year
S:38 = Month
S:39 = Day
S:40 = Hours
S:41 = Minutes
S:42 = Seconds

Just
XIC MY_BIT OSR TEMP_BIT COP S:37 N7:0 6
would take a snapshot enabling you to send it to the spread sheet.

Or you could just use a TON instruction if the period between changes is less that 9 hours and second accuracy is OK
SOR XIC MY_BIT OSR TEMP_BIT MOV T4:0.ACC N7:0 EOR SOR XIO MY_BIT TON T4:0 1 32767 0 EOR
Or ... maybe I've misunderstood?
Alaric
Floating point long duration hour timer in F8:1:

RTO T4:0 1 32767 0
GRT T4:0.ACC 3600 BST ADD 1 F8:0 F8:0 NXB SUB T4:0.ACC 3600 T4:0.ACC BND
CPT F8:1 F8:0+(T4:0.ACC|3600)

For SLC replace the CPT intruction with
BST DIV T4:0.ACC 3600.0 F8:2 NXB ADD F8:0 F8:2 F8:1 BND
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.