View Full Version : timers and subroutine
March 30th, 2008, 01:34 AM
Pretty new to this stuff and here is the problem I am looking for an answer too.
I have a main program that calls my subroutine which is working perfectly, however when I press a reset pushbutton in my main program, it should unlatch my binary bit B3:0/1. It does, but for some reason the timers in my subroutine fail to de-energize (they stay enabled and the DN flags don't de-energize). Here is my subroutine:
March 30th, 2008, 01:59 AM
Can you post your code ? (zipped rss file)
March 30th, 2008, 04:14 AM
We need to see the rung where the push button turns B3;0/1 on & off before we can help. B3:0/1 may be alternating off/on every other scan, which is so fast that you won't see it on your PC screen.
March 30th, 2008, 05:28 AM
Removed as PeterW noted an error in my statement thanks Peter
PeterW you are dead right, I missed that my excuse is I need a larger screen so I dont need to scroll across
March 30th, 2008, 05:34 AM
The done bits need to be changed to XIO, instead of the XIC, that you have used, for these timers to operate in this subroutine, so if you are seeing the timers running, then you must be using them somewhere else, as well as in this subroutine.
Don't agree with that. The timers are T4:1, T4:2 and T4:3. The first N/O is T4:0, which I suspect is outside the sub routine, then once that has timed out T4:1 times, which in turn on completion starts timer T4:2, etc.
The code in the sub-routine looks fine if T4:0 exists externally.
As others have mentioned, we would need to see the external code.
March 30th, 2008, 11:22 AM
Here is my main program:
I am using the RSLogix500 PLC Simulator form theLearningPit.com. I mainly am just wondering if there was something I misunderstood in the way subroutines work. If not, this could be a bug in the Simulator software. The T4:0 and T4:4 Timers reset perfectly when I hit the STOP button in the main program; it is just the T4:1 to T4:3 timers that the EN and DN flags stay stuck on.
I don't have access to the PLC till Monday, I can try it on the real-world one and see if this problem goes away.
Thanks for all the responses!!
March 30th, 2008, 11:33 AM
It's your understanding.
When B3:0/1 is turned off because of the stop the logic leading to T4:0 and T4:4 is still scanned - it's just evalueated as FALSE letting the timer commands perform the appropriate 'turning off' functions like turning off the EN and DN flags.
But the timers in the subroutine ARE NOT SCANNED AT ALL. They don't get the opportunity to process the turning off of the enable.
Try this as a test - remove the B3:0/1 and T4:0/DN in rung #3 of your main program.
March 30th, 2008, 01:42 PM
Ahhhh, yes, I get it now. That did the trick. Thank-you bernie.