macro_command main()
bool on=1
short A
GetData(A, "Local HMI", LW, 0, 1)
select case A
case 1
SetData(on, "Local HMI", LB, 1, 1)
break
case 2
SetData(on, "Local HMI", LB, 2, 1)
break
case 3
SetData(on, "Local HMI", LB, 3, 1)
break
case 4
SetData(on, "Local HMI", LB, 4, 1)
break
case 5
SetData(on, "Local HMI", LB, 5, 1)
break
end select
end macro_command
当LW0寄存器中的值为1时,把LB1置ON;值为2时,把LB2置为ON……值为5时,把LB5置为ON。 |