You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

Reply
 
Thread Tools Display Modes
Old May 24th, 2023, 05:22 AM   #1
rbrt95
Member
Italy

rbrt95 is offline
 
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)??
  Reply With Quote
Old May 24th, 2023, 06:35 AM   #2
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
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.
  Reply With Quote
Old May 24th, 2023, 09:16 AM   #3
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,537
e.g.
Attached Images
File Type: jpg any1.jpg (140.4 KB, 44 views)
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com
  Reply With Quote
Old May 24th, 2023, 09:16 AM   #4
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,537
FC1 as follows:
Attached Images
File Type: jpg any2.jpg (98.1 KB, 43 views)
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com
  Reply With Quote
Old May 24th, 2023, 09:17 AM   #5
L D[AR2,P#0.0]
Lifetime Supporting Member
United Kingdom

L D[AR2,P#0.0] is offline
 
Join Date: Nov 2006
Location: UK
Posts: 6,537
anypointer struct:
Attached Images
File Type: jpg any3.jpg (80.0 KB, 45 views)
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com
  Reply With Quote
Old May 25th, 2023, 11:21 AM   #6
rbrt95
Member
Italy

rbrt95 is offline
 
Join Date: May 2023
Location: Italy
Posts: 2
Quote:
Originally Posted by L D[AR2,P#0.0] View Post
anypointer struct:
Thank you so much mate, you helped me a lot!! wonderful job
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Topics
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


All times are GMT -4. The time now is 11:18 PM.


.