anlyl2014
大吉大利
級別: 網絡英雄
|
第一次用威綸通的HMI,想在屏上顯示程序行號,當LW=0,時在屏上的LB0=1,顯示為紅色,然后,當LW=1時,LB1=1,LB0變為0,也就是說,LW=n,LBN=1,共300行,寫了一段宏代碼,能用,但是,300行那么多,有沒有更簡的方法嗎?希望高人指正,謝謝。 下面是宏代碼:限于篇幅只列出0到4步 macro_command main() short a bool on=1,off=0 GetData(a,"Local HMI",lw,0,1) if a==0 then SetData(on,"Local HMI",lb,0,1) else SetData(off,"Local HMI",lb,0,1) end if if a==1 then SetData(on,"Local HMI",lb,1,1) else SetData(off,"Local HMI",lb,1,1) end if if a==2 then SetData(on,"Local HMI",lb,2,1) else SetData(off,"Local HMI",lb,2,1) end if if a==3 then SetData(on,"Local HMI",lb,3,1) else SetData(off,"Local HMI",lb,3,1) end if if a==4 then SetData(on,"Local HMI",lb,4,1) else SetData(off,"Local HMI",lb,4,1) end if end macro_command |
|
---|---|---|
|