恭喜,你发布的帖子
发布于 2024-04-07 16:17:03
12楼
博图帮助里面有。在 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.
我刚才搜索了帮助,看帮助的意思是指针的形式较好,优化块是副本的形式传递,我这么理解对吗?不太理解两种形式的应用
请填写推广理由:
分享
只看
楼主