9/23/2013 6:46 AM | |
Posts: 46 Rating: (1) |
I don't know the answer as to why, but if you look in my toppic (Array's and indexing) you will see that the use of LAR2 is strongly discouraged. As it happens I am now updating my STL code so I don't use this memory area anymore, using Temp variables instead.
|
This contribution was helpful to1 thankful Users |
9/23/2013 6:48 AM | |
Joined: 10/7/2005 Last visit: 9/15/2024 Posts: 3020 Rating: (1054)
|
Hello GHu it is not a bug, it is a feature (albeit a rather annoying one)! While you can use AR2 in an FB yourself, you need to be very careful when doing so and the FAQ In which operations does STEP 7 overwrite ACCU or register contents? containsall the requireddetails about this. I hope this helps |
Cheers |
|
This contribution was helpful to1 thankful Users |
9/23/2013 7:01 AM | |
Joined: 3/24/2009 Last visit: 7/9/2024 Posts: 535 Rating: (112) |
Dear Gilles, the AR2 is used to access variables inside of a multi-instance-DB. For 'normal' instance-DBs the AR2 is set to 0 and the accesses to "FIfoDbNum" will work correct. When you call a multi-instance-block, this call will set the AR2-register and accesses to your variable will work as expected. When you load your own value to the AR2-register, the accesses will use a wrong offset and you will get an unexpected (wrong) value. Can you tell us, why you want to use the LAR2-instruction? Have a loook at this link and this FAQ. I hope this helps. Best regards, yy1 |
Last edited by: yy1 at: 9/23/2013 7:46 AMToo slow, fritz was faster ;-) |
|
This contribution was helpful to2 thankful Users |
Follow us on