Array handling in STL (S7)

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
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
 
Last edited:
K

Basically, because the rest of the code was in STL.
But I've done a small part in a FC in SCL.

Thanks
G

Why does it have to be in STL ?
This is a no-brainer in SCL, you have even made the code basically in SCL already.
 
Tss

And I do not agree... not every customer accepts the usage of just any language. Also, for languages like graph and scl you need an extra license.

Anyway thanks for being friendly...
🍺

And so what. That is no argument. Use the right tool for the job.
 
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...
Replies
13
Views
7,271
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...
Replies
2
Views
2,925
Hi, I'm having an issue in crimson 3.0 when I create a programme using a case statement referencing a fault word that each bit needs to change the...
Replies
1
Views
83
I am trying to copy an array of real numbers into a UDT with a real data type element. I have attached a snip below showing my COP instruction...
Replies
4
Views
200
I have an array of 55 REAL values. Is there a way to multiply based on the array location ? I have 55 transfer belts that are equally spaced...
Replies
3
Views
149
Back
Top Bottom