Indirect Addressing Advanced Exercise from PLCDEV.com

Test Code

Hello LD,

I tested your code and found out result acc to question :):):).But some parts in your code i do confusion. Could you give me a hand to understand in this code or explain a bit?

1.
L 2 // first ACCU1 then move to ACCU2
FL: T #ii // fetch array index

Why we need to intialize array index with 2 and later subtract 1 to get DB index 1?

2.
L #ii // fetch array data
+ -1 //

Result will store in ACCU1?

SLD 5 // shift 5 for DWORD and REAL in S7
LAR1 P#DBX 0.0 //

load AR1 with pointer + "above result" ACCU1?

Can i monitor ACCU1 online? i only found ACCU2 to monitor.
Thanks in advance and please!

Vat Table.jpg
 
Last edited:
Re: Your question 1

The fact that you have asked this question implies you have not read and comprehended posts 10,11,12,13
Go back to them and follow the steps I took in hand compiling the pseudo code. Do not move on to the next step until you understand each one.

Re: Your qeustion 2

Click on the instruction and then press F1 and read the Siemens Help.

Re: Your Question 3

Accu1 is titled (confusingly) Standard and is enabled by right clicking in the right hand side of the screen and selecting default status.

ppp1.jpg
 
correct for zero based addressing in STL

Finally, add in the Begin..End processing.

Code:
      L     2
FL:   T     #ii
      L     10
      >I    
      JC    endf

//Let x:=Values[i]  for convenience
      OPN   "PreFill Values"            //open value db
      L     #ii                         //fetch array index 
      +     -1                          //correct for zero based addressing

Hello LD,

Could u please explain me why u have "Correct for zero based addressing by adding +1? Coz my array is start from [1..10] ? Code is working but i wanted to understand more about your comments such as "correct for zero based addressing" and "for convenience".

After i read it, your post #17 and read it again ur post, i got it ald. Thanks again LD.
 
Last edited:

Similar Topics

Howdy folks, I am an Allen Bradley guy currently living in an Emerson world. Working with Rx3i on PacSystems Machine Edition v. 9.6? i think...
Replies
3
Views
620
Hello, I'm very new to programming with absolutely zero schooling in this field and pretty hands off training in my new role, it's been fun...
Replies
4
Views
668
Hello Friends, I am trying to index M Bits, however GX Works2 is not allowing it with following message. https://ibb.co/zPcqj6M...
Replies
3
Views
1,378
Hi All, which the best way to do the indirect addressing in an optimize DB? Ccurrently this is my partial code inside an FB...
Replies
7
Views
2,273
Hey everyone, Just used the PLC5/Logix migration utility to convert a program, and while addressing the PCEs, I noticed a lot of errors for "XIC...
Replies
12
Views
1,971
Back
Top Bottom