发布于 2014-09-12 10:25:21
5楼
wincc中定义两个外部变量do40和do41分别对应输出地址q4.0和q4.1,然后定义一个内部变量圆x坐标positionx,然后在全局vbs脚本中(触发周期1s):
dim tag(3)
tag(0)=hmiruntime.tags("do40").read
tag(1)=himruntime.tags("do41").read
tag(2)=hmiruntime.tags("positionx").read
if tag(0) then
tag(2)=tag(2)-1//要求移动速度快点可以增加这里的常数1
end if
if tag(1) then
tag(2)=tag(2)+1//要求移动速度快点可以增加这里的常数1
end if
if tag(2)>300 then
tag(2)=0
end if
if tag(2)<0 then
tag(2)=300
end if
hmiruntime.tags("positionx").wirte tag(2)
然后圆的坐标连接内部变量positionx。
活到老,学到老!为了生活学习吧!