451621206
级别: 探索解密
精华主题: 0
发帖数量: 8 个
工控威望: 129 点
下载积分: 966 分
在线时间: 18(小时)
注册时间: 2014-03-04
最后登录: 2023-04-10
查看451621206的 主题 / 回贴
楼主  发表于: 2015-06-15 22:11

macro_command main()
//显示元件条件
bool a=true
bool b=false
//定义比较条件
short n1,n2
short m1,m2
//定义比较时间段
//时
short s0,s1,s2
//分
short f0,f1,f2
GetData(f1, "Local HMI", LW, 80, 1)

//时间自加
f2=f0+f1
//系统时间传输
GetData(n1, "Local HMI", LW, 9012, 1)
GetData(n2, "Local HMI", LW, 9011, 1)

//自加系数
short j1,j2
if n1==s0 and n2>=f0 and n2<= f2 then
SetData(a, "Local HMI", LB, 55, 1)
j1=j1+1
else
SetData(b, "Local HMI", LB, 55, 1)
end if
//比较传输
if  j1==0  then
GetData(s0, "Local HMI", LW, 50, 1)
GetData(f0, "Local HMI", LW, 60, 1)
else
end if
if  j1==1  then
GetData(s0, "Local HMI", LW, 51, 1)
GetData(f0, "Local HMI", LW, 61, 1)
else
end if
if  j1==2  then
GetData(s0, "Local HMI", LW, 52, 1)
GetData(f0, "Local HMI", LW, 62, 1)
else
end if
if  j1==3  then
GetData(s0, "Local HMI", LW, 53, 1)
GetData(f0, "Local HMI", LW, 63, 1)
else
end if
if  j1==3  then
GetData(s0, "Local HMI", LW, 53, 1)
GetData(f0, "Local HMI", LW, 63, 1)
else
end if
if  j1==4  then
GetData(s0, "Local HMI", LW, 54, 1)
GetData(f0, "Local HMI", LW, 64, 1)
else
end if
if  j1==5  then
GetData(s0, "Local HMI", LW, 55, 1)
GetData(f0, "Local HMI", LW, 65, 1)
else
end if
if  j1==6  then
GetData(s0, "Local HMI", LW, 56, 1)
GetData(f0, "Local HMI", LW, 66, 1)
else
end if
if  j1==7  then
GetData(s0, "Local HMI", LW, 57, 1)
GetData(f0, "Local HMI", LW, 67, 1)
else
end if
if  j1==8  then
GetData(s0, "Local HMI", LW, 58, 1)
GetData(f0, "Local HMI", LW, 68, 1)
else
end if
if  j1==9  then
GetData(s0, "Local HMI", LW, 59, 1)
GetData(f0, "Local HMI", LW, 69, 1)
else
end if
if  j1>9  then
j1==0
else
end if






if n1==s0 and n2>=f0 and n2<= f2 then
SetData(a, "Local HMI", LB, 55, 1)
j1=j1+1
else
SetData(b, "Local HMI", LB, 55, 1)
end if

这个j1如何在这个条件接通的情况下只加一次!



选择周期执行!



求大师解答!!谢谢!