Logix 5000 FAL Read Every Other Member

AMarks95

Member
Join Date
Jul 2018
Location
South Dakota
Posts
224
Is there a way to use the FAL instruction to do +=2 instead of +=1? I have an array that is organized with alternating "data" and "flag" values.

If not, I'll just have to use a FOR loop.
 
Set the Length parameter value to (array_length / 2), and use the expression
Code:
the_array[control.POS * 2]

or

the_array[(control.POS * 2) + 1]

in the FAL instruction?
 
Set the Length parameter value to (array_length / 2), and use the expression
Code:
the_array[control.POS * 2]

or

the_array[(control.POS * 2) + 1]

in the FAL instruction?
Thanks, that definitely seems like it would work, but I ended up figuring out the structured text for loop instead and it's much more readable. Just a quick JSR and it's done.

Code:
SIZE( Array_Raw, 0, length );

FOR i := 0 to ( length - 1 ) by 2 DO

    Array := Array_Raw * ( 16.0 / 100.0 );

END_FOR;
 
Everybody on this forum has their pet soapbox - I'm no exception to that.

My soapbox is to avoid brand-specific instructions with complex behaviors like FAL and its cousins. They came about because of the perception of needing to do those sorts of things in ladder. The ST is easier to understand, it is much more processor brand independent, and there is no need to research how the instructions work and their curious side-effects. If someone does not understand ST they really don't understand LD either.

Shouldn't the code inside your loop have some reference to the 'i' index?
 
Everybody on this forum has their pet soapbox - I'm no exception to that.

My soapbox is to avoid brand-specific instructions with complex behaviors like FAL and its cousins. They came about because of the perception of needing to do those sorts of things in ladder. The ST is easier to understand, it is much more processor brand independent, and there is no need to research how the instructions work and their curious side-effects. If someone does not understand ST they really don't understand LD either.

Shouldn't the code inside your loop have some reference to the 'i' index?

Devils advocate and the counterpoint, in the case of Rockwell, STX often requires a different license that not everyone wants to pay for. And most technicians who support the PLC when you walk out the door, hate STX and Function Blocks.
 
Shouldn't the code inside your loop have some reference to the 'i' index?
Oops

Code:
SIZE( Array_Raw, 0, length );

FOR i := 0 to ( length - 1 ) by 2 DO

    Array[i] := Array_Raw[i] * ( 16.0 / 100.0 );

END_FOR;

Devils advocate and the counterpoint, in the case of Rockwell, STX often requires a different license that not everyone wants to pay for. And most technicians who support the PLC when you walk out the door, hate STX and Function Blocks.

And yes, I agree FB is terrible. I love ST though. If they can read they can handle ST, especially something this simple. There are also comments that I left out as the code is a generic example.
 

Similar Topics

Hi all, In my Rslogix 5000 project, I use FAL instruction(File Arithmetic and Logic),Dest and expression are INT data type, When use res...
Replies
12
Views
12,760
I'm trying to copy the contents of an array to another array. I'd like to start at different positions in the array. ex: array1[12] ->...
Replies
4
Views
10,544
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
164
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
597
Back
Top Bottom