451621206
級別: 探索解密
精華主題: 0
發(fā)帖數(shù)量: 8 個
工控威望: 129 點
下載積分: 966 分
在線時間: 18(小時)
注冊時間: 2014-03-04
最后登錄: 2023-04-10
查看451621206的 主題 / 回貼
樓主  發(fā)表于: 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
//系統(tǒng)時間傳輸
GetData(n1, "Local HMI", LW, 9012, 1)
GetData(n2, "Local HMI", LW, 9011, 1)

//自加系數(shù)
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如何在這個條件接通的情況下只加一次!



選擇周期執(zhí)行!



求大師解答!!謝謝!