各位:请教下,我现在触摸屏上20个按钮,还有一个总按钮
1,按下总按钮,1#--20#按钮复位
2,1#--20#按钮只要有一个按钮按下,总按钮就复位
我现在做的,第一点可以做到,但是做的第二点的时候,不行,只要总按钮是ON的状态,1#--20#无法长时间按下,帮忙看看哪里问题吧?
macro_command main()
bool b=1,c=0,quanxuan,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30
GetData(quanxuan, "Local HMI", LB, 400, 1)
if quanxuan==1 then
SetData(c, "Local HMI", LB, 301, 1)
SetData(c, "Local HMI", LB, 302, 1)
SetData(c, "Local HMI", LB, 303, 1)
SetData(c, "Local HMI", LB, 304, 1)
SetData(c, "Local HMI", LB, 305, 1)
SetData(c, "Local HMI", LB, 306, 1)
SetData(c, "Local HMI", LB, 307, 1)
SetData(c, "Local HMI", LB, 308, 1)
SetData(c, "Local HMI", LB, 309, 1)
SetData(c, "Local HMI", LB, 310, 1)
SetData(c, "Local HMI", LB, 311, 1)
SetData(c, "Local HMI", LB, 312, 1)
SetData(c, "Local HMI", LB, 313, 1)
SetData(c, "Local HMI", LB, 314, 1)
SetData(c, "Local HMI", LB, 315, 1)
SetData(c, "Local HMI", LB, 316, 1)
SetData(c, "Local HMI", LB, 317, 1)
SetData(c, "Local HMI", LB, 318, 1)
SetData(c, "Local HMI", LB, 319, 1)
SetData(c, "Local HMI", LB, 320, 1)
end if
以上是按下总按钮后1#--20#按钮全部复位,这个是OK了
但是以下的,不行呢,哪里问题啊
GetData(a11, "Local HMI", LB, 301, 1)
GetData(a12, "Local HMI", LB, 302, 1)
GetData(a13, "Local HMI", LB, 303, 1)
GetData(a14, "Local HMI", LB, 304, 1)
GetData(a15, "Local HMI", LB, 305, 1)
GetData(a16, "Local HMI", LB, 306, 1)
GetData(a17, "Local HMI", LB, 307, 1)
GetData(a18, "Local HMI", LB, 308, 1)
GetData(a19, "Local HMI", LB, 309, 1)
GetData(a20, "Local HMI", LB, 310, 1)
GetData(a21, "Local HMI", LB, 311, 1)
GetData(a22, "Local HMI", LB, 312, 1)
GetData(a23, "Local HMI", LB, 313, 1)
GetData(a24, "Local HMI", LB, 314, 1)
GetData(a25, "Local HMI", LB, 315, 1)
GetData(a26, "Local HMI", LB, 316, 1)
GetData(a27, "Local HMI", LB, 317, 1)
GetData(a28, "Local HMI", LB, 318, 1)
GetData(a29, "Local HMI", LB, 319, 1)
GetData(a30, "Local HMI", LB, 320, 1)
if a11==1 or a12==1 or a13==1 or a14==1 or a15==1 or a16==1 or a17==1 or a18==1 or a19==1 or a20==1 or a21==1 or a22==1 or a23==1 or a24==1 or a25==1 or a26==1 or a27==1 or a28==1 or a29==1 or a30==1 then
SetData(c, "Local HMI", LB, 400, 1)
end if
end macro_command
因为在我的总按钮按下之后,宏指令就一直执行前的程序了,导致我的1#--20#按钮一按下就会复位。
|