恭喜,你发布的帖子
发布于 2024-04-11 21:54:16
15楼
博图帮助里面有。在 Parameter transfer at block call 下面的 Transfer parameter as copy or as pointer,重点如下。
Note:Parameter transfer between blocks with optimized access and blocks with standard access
If structures are transferred to the called block as in/out parameters during a block call, they are transferred by default as pointers (Call by reference).
However, this does not apply if the two blocks have different optimization settings: If one of the blocks has the property "Optimized access" and the other block has the property "Standard access", all parameters are always transferred as copies (Call by value).
If the block contains numerous structured parameters, this can quickly lead to the temporary memory area (local data stack) overflowing.
Problems can also occur if the original operands are changed by asynchronous processes, such as by HMI access or interrupt OBs. If the copies are copied back to the original operands after the block processing, the changes carried out asynchronously since the creation of the copy during the block call are hereby overwritten at the original operands.
You can avoid this by setting the same access type for both blocks or by having the asynchronous access written first to a separate memory area and then copying this area synchronously at a suitable time.
是不是优化的FB inout连接优化块的结构体数据是传引用,不一样时候传值?copy完等FB执行结束再写回去?
请填写推广理由:
分享
只看
楼主