威纶通官方论坛

宏指令输出

[复制链接]
发表于 2014-4-15 21:51:16 | 显示全部楼层 |阅读模式
PLC X1 X2同时有输入信号时,Y0有输出。请教各位高手如何用宏指令做。谢谢
 楼主| 发表于 2014-4-16 19:04:32 | 显示全部楼层
各位高手帮帮我啊!谢谢
 楼主| 发表于 2014-4-17 22:09:04 | 显示全部楼层
版主帮帮小弟啊,让小弟有信心学习啊,谢谢
发表于 2014-4-21 18:46:18 | 显示全部楼层
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_2  then
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 17:12:09 | 显示全部楼层
本帖最后由 玉树林枫 于 2014-4-22 20:33 编辑

谢谢!
编译时,出现错误
我用的是FX 0S的PLC
请问高手我错在那里了吗?
 楼主| 发表于 2014-4-23 15:18:02 | 显示全部楼层
本帖最后由 玉树林枫 于 2014-4-25 21:58 编辑

谢谢!谢谢各位高手指点
发表于 2014-4-23 16:04:22 | 显示全部楼层
本帖最后由 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==true  then
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
 楼主| 发表于 2014-4-24 21:16:58 | 显示全部楼层
谢谢各位高手指教!
您需要登录后才可以发帖 登录 | 注册

本版积分规则

回复帖子

Archiver|小黑屋|威纶通官网 ( 粤ICP备06054553号 )

GMT+8, 2024-5-18 23:27

Powered by Discuz! X3.4

© 2001-2023 Comsenz Inc.

快速回复 返回顶部 返回列表