5/5/2012 10:21 AM | |
Posts: 3 Rating: (1) |
Hi, I need tocall a temporary variable in a FBfrom another FB. Is that possible ? If so,how? |
This contribution was helpful to1 thankful Users |
5/5/2012 10:48 AM | |
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Dear maviizi , you will have to move the variablefrom TEMP to STAT. Then you can access it via the instance DB of that function block. If you cannot do that you will have to store your TEMPvariable an a global DB or global memory area (i.e. flag memory area). Regards. |
Give us your feedback and show us your respect! |
|
5/5/2012 10:55 AM | |
Posts: 557 Rating: (64) |
Hello, Try this...... IN FB1 L Temp1 (LW10) call FB2 IN FB1 L DB#16#87000000 LAR1 L W [AR1,P#10.0]== Temp1 Report system error is also work on same concept. |
This contribution was helpful to1 thankful Users |
5/5/2012 10:59 AM | |
Posts: 2348 Rating: (263) |
Can you clarify for what purpose do you need such task? It can be done as stated above, but it's quite exotic. Maybe you can add additional inputs/outputs or use muliinstance concept? |
This contribution was helpful to1 thankful Users |
5/5/2012 11:09 AM | |||||||
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Dear Eastern , do you know what happen if between your two blocks is another block which uses same local area? Regards. |
||||||
Give us your feedback and show us your respect! |
|||||||
5/5/2012 11:29 AM | |||||||
Posts: 557 Rating: (64) |
Hello TIBI68
Yes actually 87 is a machine code of local previous stack, while calling fc/fb under fc/fb. local stack L & previous stack V are interlink. here in simatic manager you can not use V memory therefore i have used logic in machine language. Hope you understood. Regards |
||||||
5/5/2012 11:37 AM | |
Posts: 3 Rating: (1) |
I am creating a function block to protect the program against copy. It is related to CPU Serial Number. Actually i created it. I need to call a variable from my Licence FB to another fb. This variable must be unseen in Licence DB. TheLicence FB is protected by "Block Privacy".You know that stat variables are seenon db monitoring but temps aren't. What if i protect this db by "know how protection" it can be cracked. So i have to put this variable into temp and call it from here. Thanks for your replies. |
5/5/2012 11:43 AM | |||||||
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Dear Eastern , you did not understood what I wanted to say. The two blocks I inserted are an example and are standing for any other blocks using same local area. FC1 A M0.0 = L0.0 FC3 A M1.0 = L0.0 FC4 A M2.0 = L0.0 Call FC2 IN FC2 L DW#16#87000000 LAR1 A [AR1,P#0.0] = Will get result of m0.0 Which M will be in the result (M0.0, M1.0 or M2.0)? Regards. |
||||||
Give us your feedback and show us your respect! |
|||||||
This contribution was helpful to1 thankful Users |
5/5/2012 12:07 PM | |
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Dear maviizi, thanks for your reply, that makes us understand whatkind of function you are trying to implement. I am sure you will find a way which suits your needs. A 100% security is not available. Regards. |
Give us your feedback and show us your respect! |
|
5/5/2012 12:14 PM | |
Posts: 2348 Rating: (263) |
I like this idea Though i'm thinking about another implementation i won't ask you how exactly you did it - neither will share my implementation features - one of protection measures is to keep it's mechanism in secret. |
5/5/2012 12:27 PM | |
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
There are lot of other way's, while the CPU has different memory areas you could pass parameters through. In addition to these software lock's there are hardware protection mechanismas wellto secure your investment, even if your softwareis getting copied. Regards. |
Give us your feedback and show us your respect! |
|
5/5/2012 12:32 PM | |
Posts: 557 Rating: (64) |
Hello, Write a logic in that way FC1 A M0.0 = L0.0 Call FC2 IN FC2 L DW#16#87000000 LAR1 A [AR1,P#0.0] = Will get result of m0.0 FC3 A M1.0 = L0.0 Call FC2 IN FC2 L DW#16#87000000 LAR1 A [AR1,P#0.0] = Will get result of m1.0 FC4 A M2.0 = L0.0 Call FC2 IN FC2 L DW#16#87000000 LAR1 A [AR1,P#0.0] = Will get result of m2.0 I hope you understood |
5/5/2012 12:43 PM | |
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Dear Eastern , your exampledoes only work, if the two blocks are next to each other. What if an interrupt OB strikes in between? Regards. |
Give us your feedback and show us your respect! |
|
5/5/2012 1:01 PM | |
Joined: 10/7/2005 Last visit: 3/28/2024 Posts: 3002 Rating: (1045)
|
Doesn't matter, each priority class OB maintains its own local data stack, so the interrupt will kick in, do its thing and maviizicode will continue to work as if nothing happened. Step 7 itself uses V memory (TEMP variables of the calling block) every time you usefor example a complex data type as an Input for an FC. |
Cheers |
|
This contribution was helpful to2 thankful Users |
5/5/2012 1:07 PM | |
Joined: 12/1/2009 Last visit: 2/21/2024 Posts: 672 Rating: (147) |
Mensch fritz , why did you answered for him? Anyway, initiallythe software structure was and is still not revealed to us. So, if the two blocks are not next to each other, the suggested solution will not work. But the function in general was very nicely explained to us. Regards. |
Give us your feedback and show us your respect! |
|
5/5/2012 2:42 PM | |
Joined: 4/30/2007 Last visit: 3/9/2023 Posts: 231 Rating: (23) |
Butif inside the interruption OB it is calling another FC or FB? Will still work? |
5/5/2012 2:56 PM | |
Joined: 10/7/2005 Last visit: 3/28/2024 Posts: 3002 Rating: (1045)
|
It sure will dear Marciano, since - as mentionedbefore - each priority class (i.e. each OB)has its own local data stack. When the interrupt is finished, the Block that was interrupted continues as if nothing happened (its local data and local dataof the Block from which it was called (aka V memory) are all still there). |
Cheers |
|
This contribution was helpful to3 thankful Users |
4/20/2016 8:45 AM | |
Joined: 1/15/2015 Last visit: 3/22/2022 Posts: 66 Rating: (0) |
Dear fritz, Can you please explain how to use the V stack,Because i can not find anything in the help about that. Thank you. |
Follow us on