英文:
TwinCAT 3 HMI button as a counter
问题
我想在TwinCAT 3 HMI中使用按钮作为计数器。例如,工作流程如下。我有10个函数,我必须通过按下一个按钮来逐个触发这些函数以在TwinCAT 3中触发它们。我该如何做到这一点?
英文:
I want to use a button as a counter in TwinCAT 3 HMI. For example, the work flow is like this way. I have 10 functions and I have to trigger one by one by pressing a single button to trigger the functions in TwinCAT 3.
How can I do this?
答案1
得分: 3
首先,您需要将按钮链接到一个函数(例如,将其链接到按钮的'OnMouseClick'事件)。
链接的函数充当主函数,根据内部计数器值调用正确的函数。
因此,基本上,您需要以这样的方式设计主函数,使其
- 每次调用时增加一个计数器,并且
- 根据实际计数器值调用正确的函数。
英文:
First, you need to link the button to a function (e.g. by linking it to the 'OnMouseClick' event of the button).
The linked function acts as a master function which calls the correct function depending on an internal counter value.
So basically, you design that master function in a way, that it
- increments a counter every time it is called and
- calls the correct function depending on the actual counter value.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论