Clearing Portions of Arrays

golftmd13

Member
Join Date
Feb 2018
Location
Missouri
Posts
9
Say i have an Array[100] and i want to clear words [5]-[60] for example. How can i do that in the PLC without putting in a bunch of CLR commands and consolidate that into one command if possible?
 
Easy... Clr Array[ArrayNum]
Now just set a little counter up and allow the Clr command to run when a LEQ and GEQ are true. GEQ Test A:ArrayNum Test B:5, LEQ Test A:ArrayNum Test B:60, CNT Up element is ArrayNum every scan the counter is uped and that array element is cleared.

If you want to try and clear them in one scan cycle, you might be able to pull it off with a LBL ahead of the CLR rung, and a JMP within the CLR counter rung. this would keep it running through that section until the counter causes the LEQ to go false.
 
Last edited:
Use and FAL where expression = clear value tag or 0 and set mode to all. Then either hard code .LEN or move a tag value into .LEN for the amount of tags to be cleared.
 
Here is a simple manual version. I used EQU instruction so I could manually enter my start and end positions.

The only trick is to use a math expression in the Destination of the FAL and add 1 to you Length because of Array starting at 0

FAL CLEAR.PNG

Fal clear tags.PNG
 
Assuming this is in the context of Logix processors, the File Fill (FLL) is intended for this purpose. For the example given, it would be:

FLL
Source: 0 (zero)
Dest: Array[5]
Length: 56
 

Similar Topics

I'm online with a 90-30 using PAC ME 9.8 No one has gotten online with this PLC for many years and the the I/O fault table has a total of 1209...
Replies
6
Views
2,961
Using an L81 - I have the arrangement below that will try the Ethernet Radio first and if that fails use the Cellular Radio. The Failover works...
Replies
16
Views
3,328
Since this is the most helpful place on earth for us programmers, I'm back with another one. Using Logix v32 I've got an array with 100 elements...
Replies
9
Views
2,941
Hey guys, I'm still pretty new to PLC's in general. For a program on RSLogix 500 with a micro1400 and pvp400, we are currently logging data for...
Replies
9
Views
2,799
I am currently working in RSLogix 5000. I have a large data structure with the following general structure: UDT[0] Dataset1 Min Max Avg Data[90]...
Replies
14
Views
4,352
Back
Top Bottom