How to reset an array of timers in RSLogix5000

... I would consider a simple AOI with a LBL/JMP loop.

The reasons why I suggested an AOI with a LBL/JMP construct over other methods of indexing through an array are:

1. Run-time Execution Efficiency

As compared with a FOR loop with a single-rung target routine, an AOI with LBL/JMP will typically run in less than half the time. For example, with an L7 processor the FOR overhead is about 1 microsecond per iteration. LBL/JMP is under 0.5 microseconds considering the two-rung LBL/ADD/LES/JMP construct for indexed repeat..until looping. In a case such as resetting an array-based timer (~0.1 usec per reset), loop overhead dominates total execution time. This advantage diminishes as iteration load increase (i.e., more rungs in the FOR routine target).​

2. Encapsulation of Functionality

With the suggested approach, the AOI will have an InOut parameter for a 100-element timer array. The mainline logic references ("calls") the AOI by only specifying the timer array itself as an instruction parameter. When using the FOR instruction, part of the coding is in the FOR instruction (iteration control), and part is in the target subroutine (timer array reference). There is an implicit linkage between the subroutine and specific array being operated on.

3. Protection against Run-time Processor Fault from Online Editing Errors

With a 100-element InOut array parameter, a verified and validated AOI will eliminate the possibility of an array reference fault by subsequent online editing. Unlike the FOR instruction and target routine code, the AOI cannot be edited online, and the reference to the AOI must specify an array 100 elements or larger. Assuming correct AOI code, which in this simple case can be verified by inspection, the array cannot be referenced beyond its bounds after AOI deployment. This could be partly addressed in a FOR instruction target routine by explicitly limit testing the index against array bounds, though all of it is subject to change by online edits.

4. Potential for Functional Code Reuse

Though not implied as necessary by the OP, the AOI can be used with any 100-element timer array, and throughout the entire PLC application. With FOR instruction looping, target routines for each timer array are required.

This is not intended to advocate the use of LBL/JMP pairs in general; it does attempt to demonstrate situations where they are appropriate. Keys to this particular situation are (a) LBL/JMP not far separated, actually on adjacent rungs here, and (b) encapsulating and locking down the LBL/JMP code in an AOI.
 
Indirect Addressing One Runger

As always, when using indirect addressing you need to make sure that limits are put in place to prevent over spilling the array size and causing the PLC to Stop.

OneRung.JPG
 
Here's my code as a one-rung.

It is probably less efficient than either the JMP/LBL or FOR+subroutine methods, although could be more efficient if the FLL & FAL branches are on different rungs with a different trigger (or eliminated altogether if the PRE values don't change).

FWIW.

TimerReset.png
 

Similar Topics

Hello. Looking for the best way to load the preset and then do reset on a 144 position counter array in Controllogix? I'm monitoring 144...
Replies
1
Views
1,271
I've come across an application that might be hard to explain, however I think there might be a simple explanation. I am doing an array of...
Replies
3
Views
3,373
We are using an array of bools for our fault code logic, and I need to reset all the bits in the array when the operator presses the fault reset...
Replies
2
Views
2,106
Hi Guys, I have a 1769-L24-QBFCB1 that has the OK light flashing on the embedded counter module. The manual states it is a resettable fault, but...
Replies
0
Views
31
We are using RED LION HMI Since las 15 years. To day we have found that My log file has data up to 22 Mar 2024 1:16. Then After new Log File is...
Replies
22
Views
850
Back
Top Bottom