带有覆盆子PI的信号PLC
我想通过PLC向Raspberry Pi发出信号,并且当Raspberry Pi获得该信号时,它应该运行Python脚本,并且当Python脚本正确执行并完成周期时,它应该等待来自PLC的另一个信号相同的脚本和相同的周期应该继续进行。
请提供一些建议。
I want to give signal via PLC to Raspberry Pi and when the raspberry pi gets that signal, it should run the python script and when the python script execute properly and cycle is completed, it should wait for the other signal from PLC to again run the same script and same cycle should go on.
Please provide some suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过网络:
根据您的PLC,您可以使用UDP或TCP,其中python在Raspberry上听并发送命令。根据接收到的命令,可以执行不同的脚本OU操作。有许多Python示例用于在Internet上使用此示例。
对于PLC,查找可能会更复杂,这将取决于模型和制造商,我建议您检查供应商的文档。
离散输入:
我不建议它,但是如果它不可能使用网络,则可以使用离散的数字输入(例如按钮DO)来触发Raspberry上的脚本,但是它必须具有一个由于电信号类型的差异,PLC和Raspberry之间的继电器或光耦合器接口。在这种模式下,Pyton中的Scipty继续检查数字输入的状态,并在输入状态更改时触发动作。
注意:
Via Network:
Depending on your PLC, you could use UDP or TCP, where a Python program on Raspberry listens and sends commands. Depending on the command received, different scripts ou actions could be executed. There are many Python examples for using this on the internet.
For the PLC it can be a little more complicated to find and it will depend on the model and manufacturer, I recommend that you check your supplier's documentation.
Discrete Inputs:
I don't recommend it, but if it's impossible to use a network, you could use discrete digital inputs (like buttons do) to trigger the scripts on the Raspberry, but it must have an interface with relays or optocouplers between the PLC and the Raspberry due to differences in types of electrical signals. In this mode, scripty in pyton keeps checking the status of a digital input and triggers the action when the status of the input changes.
Note: