how to assign array[x] ? in Step 7 5.5

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
relay
Posts: 33
Joined: Tue Jun 28, 2011 9:46 am
Location: Padova (IT)

how to assign array[x] ? in Step 7 5.5

Post by relay » Thu Dec 06, 2012 11:55 am

Hi all! it's possible to assign the single array position using in stand of array[1] the array[x]?


ex:

var1 array [0..15] of bool

SET
S var1[x] (in stand of var1[1]


what kind of variable should be "x"?

I tried but it seems no one kind of variable is accepted
Thanks

relay
Posts: 33
Joined: Tue Jun 28, 2011 9:46 am
Location: Padova (IT)

Re: how to assign array[x] ? in Step 7 5.5

Post by relay » Thu Dec 06, 2012 6:53 pm

I take a look for..no way, just with SCL is possible var1 where i=INT

Lepes9
Posts: 17
Joined: Fri Sep 24, 2010 10:03 pm

Re: how to assign array[x] ? in Step 7 5.5

Post by Lepes9 » Thu Dec 06, 2012 11:25 pm

Hi relay,


It is possible. Try something like this:

Code: Select all

      L W#16#0
      T LW 0

      LAR1  P##VAR1

      L     #VAR_X
      +AR1  

      SET
      =     L [AR1,P#0.0]
where VAR1 is an Array [0..15] Of Bool in the TEMP data section at Address 0.0 (I used an FC to test it).

It's just a short example written in a minute. Do you need more information?


Greet
Lepes9

relay
Posts: 33
Joined: Tue Jun 28, 2011 9:46 am
Location: Padova (IT)

Re: how to assign array[x] ? in Step 7 5.5

Post by relay » Fri Dec 07, 2012 9:33 am

Tnx lepes9!

Post Reply