wincc动画

Option Explicit
Function action
Dim a,b
Set a=HMIRuntime.Tags("A")
Set b=HMIRuntime.Tags("B")
If b.read<=634 Then 
b.Value=b.Read+3
a.Value=1015
b.Write,1
a.Write,1
Else 
a.Value=1015
b.Value=534
a.Write,1
b.Write,1
End If
‘———————————————-
Dim button,x,y
Set button=HMIRuntime.Tags("M")
Set x=HMIRuntime.Tags("X")
Set y=HMIRuntime.Tags("Y")
If button.read=0 Then
If x.read<=1000 Then
x.Value=x.Read+5
y.Value=430
x.Write,1
y.Write,1
Else 
x.Value=160
y.Value=430
x.Write,1
y.Write,1
End If
Else
End If

End Function

问题补充:
用VB实现2个空间的动画,第一个可移动,但第二个始终不能动。请帮忙看下程序哪里有错误,多谢!

最佳答案

同意楼上的观点.其实你有一种方法可以测试下,程序到底执行到哪个条件里面去了.
  建立调试标签实行变量 AA, 代码插入下列调试行
Dim button,x,y
DIM aa
Set button=HMIRuntime.Tags("M")
SET  aa=hmiruntime.tags("AA")        //lianjie  "AA"
Set x=HMIRuntime.Tags("X")
Set y=HMIRuntime.Tags("Y")
If button.read=0 Then
 aa.write,10.0
If x.read<=1000 Then
x.Value=x.Read+5
y.Value=430
x.Write,1
y.Write,1
aa.write,20.0
Else 
x.Value=160
y.Value=430
x.Write,1
y.Write,1
aa.write,30.0
End If
Else
 aa.write,40.0
End If
  界面上显示AA的值,根据AA显示的值,你就知道自己程序执行到哪些地方去过.

提问者对于答案的评价:
谢谢,问题已经解决了

原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc268669.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2019年6月11日
下一篇 2019年6月11日

相关推荐