宏指令输出
PLC X1 X2同时有输入信号时,Y0有输出。请教各位高手如何用宏指令做。谢谢 各位高手帮帮我啊!谢谢 版主帮帮小弟啊,让小弟有信心学习啊,谢谢 macro_command main()bool input_1,input_2,output
GetData(input_1,X_Binplc,1,1)
GetData(input_2,X_Binplc,2,1)
if intput_1 and input_2then
output=true
else if intput_1 ==false then
output=false
else if intput_2==false then
output=false
end if
SetData(output,Y_Binplc,0,1)
end macro_command 本帖最后由 玉树林枫 于 2014-4-22 20:33 编辑
谢谢!
编译时,出现错误
我用的是FX 0S的PLC
请问高手我错在那里了吗? 本帖最后由 玉树林枫 于 2014-4-25 21:58 编辑
谢谢!谢谢各位高手指点 本帖最后由 shenmin32 于 2014-4-23 16:07 编辑
我觉得应该是:
macro_command main()
bool X1,X2,Y0
GetData(X1, "Mitsubishi FX0s/FX0n/FX1s/FX1n/FX2", X ,1, 1)
GetData(X2, "Mitsubishi FX0s/FX0n/FX1s/FX1n/FX2", X, 2, 1)
if X1==true and X2==truethen
Y0=true
else
Y0=false
SetData(Y0, "Mitsubishi FX0s/FX0n/FX1s/FX1n/FX2",Y ,0, 1)
end if
end macro_command
另外 我觉得4楼也对 就是结尾必须有3个 end if 谢谢各位高手指教! 学习学习:)
页:
[1]