4/11/2012 9:26 AM | |
Posts: 153 Rating:
|
can anyone please explain between: OPN DI 1 L 20.0 T DBW0 AND OPN DB 1 L 20.0 T DBW0 AND HOW CAN MONITOR VALUES OF DB1 IN CASE I AM USING OPN DI 1 |
4/11/2012 10:00 AM | |
Posts: 153 Rating:
|
thanks a lot Darius!!!! I also got the same solution ......
|
12/19/2012 2:06 PM | |
Joined: 10/7/2005 Last visit: 8/29/2024 Posts: 3018 Rating:
|
Hello Puttaswamy let's put aside the word "Instance DB" for a second as it implies that this type of DB belongs to an FB and instead simply assume the following: We have created DB10 and a DB11 as "globalDB's" (manually created, neither is an Instance DB of an FB). You now want to do some indirect STL based data copying in loop from one DB to another. Indirect addressing in STL requires that the DB is explicitly opened (e.g. OPN DB abc). One way to do so in the loop is to open the DB, load the value (indirectly), then open the other DB and transfer it (indirectly). Opening both DB's in every execution of the loop is of course wasteful and you realise that Step 7 actually does have two DB registers and allows to have two different DB's open at the same time. In order to utilise both DB registers, you open one DB with the "OPN DB xyz" command (which opens this DB via "DB1" register) and open the second DB with the "OPN DI xyz" command (which opens this DB via "DB2" register) and you now do so outside of the loop. Inside the loop you now simply use "L DBW abc" to access the DB that is open via "DB1" register and "T DIW abc" to access the DB that is open via "DB2" register. When you call an FB, all that Step7 does is to automatically open the associated Instance DB in the "DB2" register and all symbolic access to the FB's parameters will automatically take place via it. As such you would typically not use the above "trick" inside an FB (or only with great care), it can come in very handy though in an FC (or OB) in cases where you need two DB's open at the same time. I hope this helps |
Cheers |
|
This contribution was helpful to
15 thankful Users |
12/20/2012 6:01 AM | |
Posts: 22 Rating:
|
fritz |
This contribution was helpful to
1 thankful Users |
12/20/2012 6:01 AM | |
Posts: 22 Rating:
|
smify Thanks for your response |
1/19/2021 1:50 AM | |
Posts: 53 Rating:
|
Thanks a lot. Your explanation was clearer. This is all about the data registers of DBs that is why we have to open OPNDI and OPNDB. It was clearer when you stated we should put aside the DB association with FBs and FCs and only think of them as stand alone DBs created. Appreciate your help. Cheers.
|
This contribution was helpful to
1 thankful Users |
Follow us on