2/4/2016 8:01 AM | |
Joined: 1/15/2015 Last visit: 3/22/2022 Posts: 66 Rating: (0) |
Dear friends i have another question please What is the difference between these two instructions: Note that :IN1 declared as a pointer of the address of DB18.DBX128.0 (16#84000400) FIRST INSTRUCTION : L P##IN1 //NOW THE VALUE IN ACC1=16#85000010,AND THE VALUE IN ACC2=16#84000400 SECOND INSTRUCTION: LAR1 P##IN1 //NOW THE VALUE IN ACC1=16#84000400,AND THE VALUE IN ACC2=16#84000400 Why this happen, both instruction should give same result in both accumulators,But in the first instruction ACC1=16#8500001 which is the address of DI2.0(instance data block 2.0),and ACC2=16#84000400 which is the address of DB18.DBX128.0 ------------------------------------------------------------------------------------------ |
Last edited by: Min_Moderator at: 2/4/2016 1:18:21 PMNew subject after splitting Last edited by: IZ ALJABRE-JORDAN at: 2/4/2016 1:49:16 PM |
|
2/5/2016 2:13 PM | |
Joined: 1/15/2015 Last visit: 3/22/2022 Posts: 66 Rating: (0) |
Yes Exactly DI is Instance DB please see the attached shots. In FB364(which has DI364) i'm calling FB9. Now in FB9,IN15 points to DI2 not to DI364 AttachmentAttachment.zip (209 Downloads) |
2/5/2016 3:27 PM | |
Joined: 5/30/2013 Last visit: 2/24/2024 Posts: 112 Rating: (37) |
My suggestion use command "PUSH", don,t used L 0, L0. For check status AR1 and AR2 or more else in STL you mast used "Breakpoint function" - only v5.x. Read more post jacek d expecially Her trick in STL Some link: Problem with AR Pointers in a FB pass DB number to afunction and call FB with passed DB Best regards zzvss |
2/6/2016 12:47 AM | |
Joined: 10/7/2005 Last visit: 4/26/2024 Posts: 3004 Rating: (1046)
|
The reason for this is simply that you must take AR2 into account as it contains the Multi Instance offset. Have a look at the end of the FAQ How do you parameterize blocks, which have "ANY"-type or "Pointer" type parameters? for one way on how to do so. Note that this way "limits" you though to add a maximum offset of 32767 bits so if your Multi Instance DB is larger than 4kB, the method below is the better option (as per access to one multi-instance FAQ)
I hope this helps
|
Last edited by: fritz at: 2/6/2016 12:58:26 AMCheers |
|
This contribution was helpful to3 thankful Users |
2/6/2016 7:40 AM | |
Joined: 1/15/2015 Last visit: 3/22/2022 Posts: 66 Rating: (0) |
Thank you all.That was very helpful |
This contribution was helpful to1 thankful Users |
2/6/2016 11:32 AM | |
Joined: 5/30/2013 Last visit: 2/24/2024 Posts: 112 Rating: (37) |
You are welcome . Best regards, zzvss |
Follow us on