Array handling in STL (S7)

Hello,

Something I need to write in STL but don't know how..


I have the input Pos_min_4. It's a integer value. this value tells me wich array index i have to process in the array Cabines. Index for example is an item in the Cabines struct. I can reach array index zero by just entering a zero between [ ], but I cannot replace this with a variable ?

An example of wich code i need in STL:

If Cabines[Pos_min_4].Transportnummer = 'NoRead' Then
Cabines[Pos_min_4].index:= Cabines[Pos_min_4].index + 1;
End_If;

Thanks,

stl.png

Naamloos.png
 
See example implementation. I've created blocks to read from the array and write to the array using JL (case statements) so no indirect addressing required. Expand UDT1 to contain all your required elements, Expand FC1/2 to cater for all 41 elements of the array.
 

Similar Topics

Hi I am using a FX3u plc and as i want to create function blocks, I have to use labels. I have to use an array in my program, I want to use a...
13
Replies
9,824
Views
Hello All, I am currently working on a Project that retrieves data from a SQL table and stores in a PLC. This data is an array with multiple rows...
2
Replies
3,510
Views
I have created a data type which contains several members, I've called the new type UDT_InfeedConveyorBelt, it contains 5 members: ActualSpeed...
24
Replies
756
Views
Hey all, it's my first post. I've been lurking a while. I've got ControlLogix L83E, Studio 5000 v32, pushing production counts to an old Modbus...
15
Replies
616
Views
Hi. I'm using RSLogix V20.05 and have a program with a recipe UDT with 50 array elements. I need to create a new recipe in the machine that is...
3
Replies
296
Views
Top