我想使用人机界面中的按钮来控制plc。结果应该是,当我打开一个按钮,另一个按钮将被关闭。为了使函数工作,我应该在屏幕周期宏中键入什么?
发布于 2022-02-28 10:42:29
因为您没有指定人机界面的型号或品牌,而且我无法从图像中识别它,而且代码似乎没有标准化为IEC-61131中的ST,所以我将其称为“伪代码”,因此您必须根据正确的语法对其进行调整。
//Declare as global or equivalent, or use a PLC memory
Bool oldM3
Bool oldM4
//------- Run cycllic --------
//Get the transition of M3
IF NOT oldM3 AND M3 THEN
oldM3 = true
M4 = false
ENDIF
IF NOT M3 THEN
oldM3 = false
ENDIF
//Get the transition of M4
IF NOT oldM4 AND M4 THEN
oldM4 = true
M3 = false
ENDIF
IF NOT M4 THEN
oldM4 = false
ENDIFhttps://stackoverflow.com/questions/71246892
复制相似问题