![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: May 2023
Location: Italy
Posts: 2
|
[AWL] assign instruction = and index adressing
Hi everybody.
I got some problems about how to perform this task Now, I got an FB where I have this code snippet that looks like: L P##DBD_134 LAR 1 A [AR1, P#0.7] = DIX 59.0 //where DBD_134 is a FB's STAT variable with absolute value 62.0 So basically it takes the 62.7 bit's value and store it in 59.0, which is a bit of the double word 56. As you can imagine, this solution is not optimal because absolute adresses would change if I modify my FB's variables, and the instruction DIX59.0 would not be effective anymore. How can I modify my code using pointer in order to the first bit of the third byte of the doubleword 56 (59.0)?? |
![]() |
![]() |
#2 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
Can you post the FB code in a cut down library?
I would create a function that returns the absolute address of the STAT variables by passing it as an any pointer, if you change the offset within the instance DB the compiled code will point to the correct address. How did the address 62.0 get into DBD_134?
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com Last edited by L D[AR2,P#0.0]; May 24th, 2023 at 06:55 AM. |
![]() |
![]() |
#3 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
e.g.
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#4 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
FC1 as follows:
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#5 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
anypointer struct:
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: May 2023
Location: Italy
Posts: 2
|
|
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modbus TCP with Do More PLC, MRX instruction | Jasondelane | LIVE PLC Questions And Answers | 1 | February 16th, 2021 10:45 PM |
FOR instruction help in Studio 5000 | DaveLM | LIVE PLC Questions And Answers | 7 | May 27th, 2017 10:27 AM |
Variable array size call to add-on instruction - A solution | Mr Modbus | LIVE PLC Questions And Answers | 4 | July 17th, 2015 08:59 AM |
Little Help With TISOFT | Brian E | LIVE PLC Questions And Answers | 6 | August 13th, 2005 07:22 PM |
Mitsubishi Index Registers | Tim | LIVE PLC Questions And Answers | 10 | December 15th, 2002 07:57 PM |