下面两个语句:
正确,可以正常使用的语句
macro_command main()
short a,b,c
GetData(a, "Local HMI", LW, 9022, 1)
GetData(c, "DELTA DVP", D, 4000, 1)
if a>=2016 then
if c==100 then
b=1982
else
b=0
end if
end if
SetData(b, "DELTA DVP", D, 280, 1)
SetData(b, "DELTA DVP", D, 11999, 1)
end macro_command
不能正常使用,但是编译没有错误的语句:
macro_command main()
short a,b,c
GetData(a, "Local HMI", LW, 9022, 1)
GetData(c, "DELTA DVP", D, 4000, 1)
if a>=2016 and c==100 then
b=1982
else
b=0
end if
SetData(b, "DELTA DVP", D, 280, 1)
SetData(b, "DELTA DVP", D, 11999, 1)
end macro_command
大家试试这两个宏指令,是否有差异,不能正常使用的为什么编译没有错误?
楼主最近还看过
第一个宏指令,不能正确显示是您有个小小的误区,您定义了是三个变量,a,c的值有固定的来源,而b的值只有在if判断通过后有值,建议您在宏指令中加一句话,如下,结果就会OK。
short a,b,c
b=0
GetData(a, "Local HMI", LW, 9022, 1)
GetData(c, "DELTA DVP", D, 4000, 1)
if a>=2016 then
if c==100 then
b=1982
else
b=0
end if
end if
SetData(b, "DELTA DVP", D, 280, 1)
SetData(b, "DELTA DVP", D, 11999, 1)
[4668]
[3360]
[3440]
[3167]
[2788]
[2796]
[2234]
[2855]
[3854]
[3627]

客服
小程序
公众号