想咨询一下关于D脚本程序的问题。在proface触摸屏内字地址类型的符号变量为temp1和inputemp1,位地址符号变量为lam1。(其实lam1就是一个数据实际显示值,inputemp1为数据设定值)
想做一个比较运算: 当条件 (inputemp1)-5
if(([w:inputemp1]-4)<=[w:temp1]<=([w:inputemp1]+4))
{[b:lam1]=1
}
else
{[b:lam1]=0
}
endif
模拟时发现无论条件(inputemp1)-5
当把条件改成如下时:
if(([w:inputemp1]-4)<=[w:temp1])
{[b:lam1]=1
}
else
{[b:lam1]=0
}
endif
模拟结果为是当inputemp1
想为一下这是什么原因呢,是脚本不能进行这种逻辑运算呢还是写的方式有问题?期待您的回答!
16-08-29 21:34