RSLogix5000 Add # to array value

russrmartin

Member
Join Date
Aug 2002
Location
Eastman, Wisconsin
Posts
744
Hey guys. Is there a simple instruction to add a value to each of the values contained in an array. I'm messing with the FAL, but can't seem to get it to do what I want.

What I need to do is add a certain value to an array. Let's say certain value =1.

Before, the array values would be
1
2
3

After,
2
3
4

It appears to me that the FAL instruction should do this, but I haven't figgered er out yet.
 
FAL.jpg



From the FAL online help, this is what you want

Ian
 
I haven't used that instruction in C-Logix, but in a PLC5 there is a mode choice that will cause the operation to be performed completely in one scan.

You should look again at the various modes available before you rule out the FAL instruction.
 
Yes,

Use All Mode to complete in one scan. Note though that the operation does not wait to complete before the scan moves on. In ALL mode it will complete in one scan.

For example if you needed to add 1 to 500 values in the array.

In All mode the rung would need to go from false to true once and all 500 values would be operated on in that scan.

Numeric mode (enter a number in the mode field) requires the instruction to be triggered one time only and it will complete that many operations per scan. So if you entered a mode of 50 then the rung would only need to go from false to true once but it would take 10 scans to complete. Even if the rung went false it would continue to finish operating until complete.

Incremental mode will perform only one operation each time the rung goes from false to true. This would require the example mentioned above to be triggered 500 times in order to complete.
OG
 
FAL mode

More Details about the "mode" I learned the hard way

Mode ALL - calculation is performed on all array members in one scan
Mode INC - calculation is performed on ONE array member per scan, Control.POS is the current array index
Mode numeric X - calculation is performed on X array members per scan eg .LEN = 60, Mode = 6 requires 10 scans. Also Control.Pos increments by 6 per scan.

Operaghost
Note though that the operation does not wait to complete before the scan moves on
I didn't have that problem with a 500 element array - Look at the execution scan time of the FAL in a L61,L62,L63
From V15 Instruction Execution Time and memory use:
FAL​
x = number of elements manipulated in one scan​
e = time for the operators in the expression (same as CPT)​
4.5 + (x * (1.6 + e) us​
to me that means it complete's execution before moving to the next instruction​




russrmartin - If you give up on the FAL try a Structured text subroutine loop
SIZE(destination,0,length-1);

FOR position = 0 TO length DO​
destination[position] :=​
numeric_expression;

END_FOR;​

 

Similar Topics

I have a tag called 'MBTCP.DATA.ReadData' INT[600] of which I would like to pull 16 sequential values into an add-on instruction. I will need...
Replies
6
Views
2,512
In RSLogix5000 I am attempting to create an add-on instruction called "SWAP" which simply swaps the values of two integer tags. Here is what the...
Replies
5
Views
1,954
Hello everyone. I'm working with RSLogix 5000 and everything looked to be perfect, I am able to watch all my devices en RSLinx. So I have a...
Replies
1
Views
1,941
I'm trying to display the concentration of a solution on an HMI. I want to do the calculation in the PLC (ControlLogix). The problem is that it...
Replies
2
Views
1,510
I usually do not share my Excel macros but in this case I feel the need to help others who got screwed by Rockwell Software. Unknown to me at the...
Replies
1
Views
4,929
Back
Top Bottom