I'm actually using the RTO timers, so the timer will not reset if the conditions prior to the timer go false. I'm trying to manually reset all 100 timers at the same time.In front of each TON instruction, have a normally closed tag that, when energized, drops the true condition to the TON instruction which will reset it.
This is more of what I was looking for. Thank you!!Clearing the Accumulators is easy with a FAL instruction (See Pic 1), but that will not clear the .DN bits for any timers that have completed.
Probably the cleanest approach is to use a FOR instruction, calling a subroutine to clear each timer (See Pics 2 and 3)... This is far preferable to using JMPs and LBLs.
Clearing the Accumulators is easy with a FAL instruction (See Pic 1), but that will not clear the .DN bits for any timers that have completed.
Probably the cleanest approach is to use a FOR instruction, calling a subroutine to clear each timer (See Pics 2 and 3)... This is far preferable to using JMPs and LBLs.
That's cool- I didn't know that was an instruction in ladder. I'm guessing it increments once per scan?
Edit: Oh, I think I see. It calls the subroutine over and over until the loop is finished?
So I will need to add the clear/reset logic to its own routine. Then, from another routine, I will add the for loop to call the clear/reset routine for the desirable number of resets needed?The problem you face is that you have for an array of TIMER[x], in essence, is an array of DINT[3x]. While the TIMER[x].ACC and .PRE are addressable by word using an FAL, the word the contains the .DN, .EN, .TT and other info is not addressable.
In doing a RES, you essentially want to clear the 1st and 3rd words of the array triple, while leaving the second word, the .PRE, untouched.
If you just clear the .ACC, but don't reset the .DN or .EN, the timers will not necessarily start ticking when re-enabled, which I suspect would be undesirable.
The best recommendation is to do it in a loop, as suggested
The second best would be to create a DINT[3x] array. Initialize the array with a FLL 0, then FAL Timer[R.POS].PRE into DINT[(3*R.POS)+1]. Now the array contains all the control bits reset, your timer PREs, and zeroed .ACC. A simple COP of DINT[x] Timer[x] will effectively reset your RTOs.
When you feel you need to reinitialize the DINT array depends on how often your .PREs change.
So I will need to add the clear/reset logic to its own routine. Then, from another routine, I will add the for loop to call the clear/reset routine for the desirable number of resets needed?
Thanks for the help.
So I will need to add the clear/reset logic to its own routine. Then, from another routine, I will add the for loop to call the clear/reset routine for the desirable number of resets needed?