Pointer and reference behavour during online change

社会主义新天地 提交于 2019-12-11 16:32:46

问题


could anyone please help me with more information about how pointers, references and interface references behave during an online change?

What do I have do watch out for? I understand from other answers that pointers may be dangerous if these are not written during each cycle, but I will primarily use Interfaces and References.


回答1:


When an online change is made, variables, function blocks and other program parts may move in a different memory location. Therefore, if the pointer address is old information, it might refer to a memory address containing something else.

So if the pointers are used, they should be updated regularly with the ADR command, like you said.

When using references and interfaces, I don't see any problems with online change because the system should handle them automatically. In TwinCAT 3, the system will readdress variables automatically (source: https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/9007199390694027.html&id=) and because it is Codesys based, I think it is the same with other systems.

When using references, it might be a good idea to check that the reference is valid. In TwinCAT 3 there is a function __ISVALIDREF and it should be also in other Codesys based systems.



来源:https://stackoverflow.com/questions/45781814/pointer-and-reference-behavour-during-online-change

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!