Warning using AR1 or AR2

Top  Previous  Next

 

Unfortunately we have to urge you to be careful using the AR1 and AR2. These registers are modified independently by the Siemens - S7 under specific circumstances or they must not be changed by the user because of the use for S7 internal purposes.

Although it was possible to program complex operations (especially in loops) very elegantly with these registers in principle, they will get quite useless because of the mentioned restrictions.

Using these registers you have to know very precisely whether and when the S7 operating system uses these for internal purposes so that no unexpected results occur. The search for the cause for maloperations which results from an unpermissible use will take much more time than needed if you do without a loop and write out explicitly 20 till 50 assignments or transfers instead.

 

The PLC simulated in TrySim does not change the contents of the AR register and does not need them for any operations which are not programmed by you explicitly. This can lead to the fact that a program functions with TrySim well but not in the real use. Such mistakes are quite difficult to find like we have been told and like we know from experience.

 

Please check the function of the parts of a program tested with TrySim which use the address register before starting up on a real S7 absolutely.

 

Naturally we will try to detect potential problem cases in TrySim and to give a corresponding warning announcement. But doing this he have to know precisely under which circumstances a S7 modifies the address registers or is dependent on a content that is not changed by the user. We are very grateful for tips on the matter. Here you find how to contact us.

 

A safe alternative is the use of the memory-indirect addressing. Unfortunately there are not such operations as +AR1 and other annoying restrictions, like,e.g., that IN-parameters are not allowed to be used as index but have to be transfered in a TEMP-variable first.

 

See also:

Indirect addressing

 

S7-300 and S7-400 are registered trademarks of the Siemens AG.