
adccommunitymod (AutomationDirect) asked a question.
Delay Timer not working, Click
Created Date: November 09,2012
Created By: cgarai
**** This post has been imported from our legacy forum. Information in this post may be outdated and links contained in the post may no longer work.****
HI, First time using the timer function. I have a delay timer that toggles the output bit true, but never resets even though the enable is false. The timer is inside a subroutine that is not visited every scan. Any clues? Thanks, Chris
Created Date: November 09,2012
Created by: scott.lawrence
I'm not too familiar with Click, but just after a quick look, are you allowing enough time in the sub for the timer to time out?
Also, I don't see a return from sub...is this normal in the Click?
Created Date: November 09,2012
Created by: cgarai
I clipped this from my program, so I forgot to include a Return.
As for time in the subroutine, no I don't allow much time, but I do come back in once per second. I was hoping that once the input goes false the delay timer starts and drops its output on it's own. But I suspect there might be a problem with that idea.
Thanks,
Chris
Created Date: November 09,2012
Created by: cgarai
Looking at the code, I also see a potential race condition, depending on how the rungs are evaluated.
Will T30 output go true before !T30 contact is evaluated? If not, then it looks to me like the Y401 coil resets in the same scan that it is set. Then it is set again on the next pass through. I haven't noticed the output toggling, but I will look into it. I'm guessing Y401 never actually goes true on the first pass.
Created Date: November 11,2012
Created by: bcarlton
The state of T30 should be available once the NC contact evaluation is reached. There may be interactions in other sections of your program. When X201 goes false do you see the Current Value of the timer (TD30) increasing toward the SetPoint in DS65?
Created Date: November 12,2012
Created by: AlbertL
A while ago, I ran into what I think is the same core issue - the behavior of a timer in a subroutine. I did some experiments, and as I recall, it appeared that the timer is not updated when the subroutine is inactive. In other words, in between calls to the subroutine, the rung containing the timer is not being scanned and timer goes into "suspended animation ".
Note that I'm very much a beginner, so this may be a totally wrong concept of what's actually happening.
Created Date: November 12,2012
Created by: bcarlton
A Timer is just an instruction. The status of the data (Current Value, Done) is only updated when the instruction is executed. it is not an independent device whcih would have an 'active ' or 'suspended ' state.
Allen Bradley SLC and Micrologix had a maximum amount of time between executions of the timer instruction (the rollover time af an internal free-running counter). I don't see such a value for the Click listed, which doesn't prove that it doesn't have one.
Created Date: November 13,2012
Created by: cgarai
My timer's work when I removed the 1 sec contact in the subroutine call. Since my timer was a 1 sec timer and the contact was a 1 sec contact that may have been the problem. I have yet to try and see if it works if it get's called more often than 1 sec, but not every scan.
It seems to me that it would be nice to have a subroutine call start a timer and not have to go back into the subroutine to have it update.
Chris
Created Date: November 13,2012
Created by: bcarlton
Since you obviously aren't too picky about acting on the state of X201 as soon as it happens (only checking each second) then this modification eliminates the timer in the subroutine.
Created Date: November 14,2012
Created by: cgarai
Yes, but I need the delay off timer function. I have my program working, but with out the one second contact. My thought was that I would avoid executing code that wasn't necessary every scan.
Created Date: November 09,2012
Created by: cgarai
HI,
First time using the timer function. I have a delay timer that toggles the output bit true, but never resets even though the enable is false. The timer is inside a subroutine that is not visited every scan.
Any clues?
Thanks,
Chris