S7: Problem with Pointer and indirect addressing

What is the error code reported by SFC20. As there is a typo in your posted code, can you confirm what actual code is running via a screen shot ?

lpo.JPG
 
Hmmmmm...

Is this a representation of the actual data ? :
Code:
DB1.G1.f1
DB1.G1.f2
...
DB1.G1.f5
...
DB1.G5.f1
...
DB1.G5.f5
.
.
.
DB10.G5.f1
...
DB10.G5.f5
Then I see 10 iterations from DB1 to DB10, and 5 iterations from G1 to G5.
If you drop the idea of looping through the data, and in stead called the data in the "normal" way, it would be dead easy.
It would also be a small job, because you would have to program an FB or FC where you process f1 to f5. This one you call in another FB or FC which you call 5 times, and you call this FB or FC in another FB or FC another 10 times. You just have to do the repetitive coding 10 + 5 times = 15 times.
Start thinking "reusable code". You can do this in FBs + IDBs, even as multiple instance, or you can do it as FCs + UDTs.

If I had to loop through this data in really large volume, then I would resort to SCL and be done with it in 5 minutes.
 

Similar Topics

Hi guys, I'm new here and I just started to work as junior automation engineer. It will be much more easier now I have access to this site. Wish...
Replies
3
Views
1,514
Hy Experts, I have some problem with this intsructions: - CREA_DBL - READ_DBL - WRIT_DBL I want to create a recipie management in 314 CPU via...
Replies
3
Views
3,570
i write code STL and simulate but result Q2.7 not set , i dont know why :scratch: , help me plz thanks LAR1 P#Q2.7 S [AR1,P#0.0] or LAR P#2.7...
Replies
3
Views
1,703
Hi! I use the following code (from FC) to copy words between DBs given an word offset address and nbr of words to copy. But I found out it fails...
Replies
3
Views
2,864
Hi! I modified some code, probably from member LD, to make a function element := ReadFromArray(firstElement : ANY, offset : INT) It seems...
Replies
2
Views
4,157
Back
Top Bottom