Still trying to understand the Adres Register

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hey,

An example code of S7:

LAR2 P#66.0 // Preset Basic Adres for AR2
L MW [AR2,P#9.0] // Call MW75, offset 9.0 + preset 66.0
T MW230 // Transfer the value of MW75 in MW230

Why and when do u use this ?


Second example:

LAR1 P#10.0
A M[AR1,P#200.6] // = M210.6
= Q [AR1,P#120.4] // = M130.4




Why using this sort of indirect adressing ?
 
Combo, actually the examples that you gave really aren't good examples of indirect addressing. If you are loading an absolute address into AR2 (i.e. P#66.0), then all of the benefits of indirect addressing are lost. The only real advantage in this case is that if the address offset of your variables changes for some reason you would only have to change AR2, but there are much better ways to handle that.

Normally, AR2 (or AR1) would be calculated dynamically, which would allow you to point to data indirectly instead of hard-coding every possible situation. Take a look at some of the many examples on this site, and you will see some real-world applications.
 

Similar Topics

First I did not a mmc now I do. SF light is on red. IF try to download hardware I get error:see hw_download picture attached. If try to download...
Replies
3
Views
2,373
Out of 21 (near identical) Modules in this system, I have only one available to test on. On start-up I check to see which Modules are not...
Replies
5
Views
4,579
Why is the configuration IP different from the actual IP address still able to run normally?
Replies
6
Views
830
Just started working with some HART loops and I'm trying out Pactware.I'm using Krohne and it works just fine recognizing my modem. I downloaded...
Replies
9
Views
1,367
Square D had a group that wanted to develop PLC compatible power monitoring. They worked out of the Cedar Rapids circuit breaker plant - before...
Replies
0
Views
826
Back
Top Bottom