下面的宏指令(是一段非线性校正程序)在电脑上离线模拟结果正确,可是下载到触摸屏(TK6100 V5)却不能执行,宏指令执行的PLC控制是用PLC的1秒时钟脉冲置位M230来实现的,宏指令结束时复位M230。请教诸位这是什么原因?
macro_command main()
bool sw=0
int a,b,c[2],d[2],k
int ha[11]={0,500,1000,1500,2000,2500,3000,3500,4000,4500,5000}
int hb[11]={180,300,540,870,1270,1710,2190,2670,3160,3620,4030}
short e,f,g
SetData(ha[0],"Local HMI",LW,8000,11)
SetData(hb[0],"Local HMI",LW,8040,11)
GetData(a,"Haiwell PLC",AI,2,1)
if a<= 0 then
a=0
else
end if
e=8000
f=8040
for g= 0 to 10
GetData(c[0],"Local HMI",LW,e,2)
if c[1]>= a > c[0] then
break
else if a>c[1] then
e=e+2
f=f+2
end if
next g
GetData(d[0],"Local HMI",LW,f,2)
k=(d[1]-d[0])*100/(c[1]-c[0])
b=d[0]+(a-c[0])*k/100
SetData(b,"Haiwell PLC",V,526,1)
SetData(sw,"Haiwell PLC",M,230,1)
end macro_command |