威纶通官方论坛

if语句出问题

[复制链接]
发表于 2019-3-2 17:12:48 | 显示全部楼层 |阅读模式
macro_command main()
short g
bool a,b,c,d,e
unsigned short shi,fen
unsigned short shiq1,fenq1,shiq2,fenq2,dl


GetData(shi, "Local HMI", LW, 9019, 1)
GetData(fen, "Local HMI", LW, 9018, 1)



GetData(shiq2, "Local HMI", RW, 148, 1)
GetData(fenq2, "Local HMI", RW, 149, 1)

if  shi==shiq2 and fen==fenq2 and g<3 then
SYNC_TRIG_MACRO(21)
d=false
SetData(d, "Local HMI", LB, 7, 1)
g=g+1
else if shi<>shiq2 and fen<>fenq2 then

g=0
end if
end macro_command

我想shi==shiq2 and fen==fenq2时只运行三次,当shi<>shiq2 and fen<>fenq2时,g归0,各 位老师哪出错了,怎么才能实现
发表于 2019-3-15 13:33:18 | 显示全部楼层
g > =3 的时候就跳出去了 然而 shi <> shiq2 and fen<> fenq2 不满足  g永远不会清零
 楼主| 发表于 2019-3-16 11:46:52 | 显示全部楼层
pcsms_RGMD55EF 发表于 2019-3-15 13:33
g > =3 的时候就跳出去了 然而 shi  shiq2 and fen fenq2 不满足  g永远不会清零

要怎么做才行,问客服竟然说没问题
您需要登录后才可以发帖 登录 | 注册

本版积分规则

回复帖子

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

GMT+8, 2024-4-27 01:35

Powered by Discuz! X3.4

© 2001-2023 Comsenz Inc.

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