wincc变量值由0变1触发一个动作

当tag1(二进制变量)由0变为1时(由1变为0不执行),执行将tag2的值赋给tag3,脚本该怎么写?请高手指教!

最佳答案

需要结合一个内部变量
示例vbs动作脚本:触发方式选择tag1有变化

Function action
Dim tag0
Set tag0 = HMIRuntime.Tags("tag0")
Dim tag1
Set tag1 = HMIRuntime.Tags("tag1")
Dim tag2
Set tag2 = HMIRuntime.Tags("tag2")
Dim tag3
Set tag3 = HMIRuntime.Tags("tag3")

tag0.Read
tag1.Read
tag2.Read
tag3.Read

If tag1.Value =1 Then

If tag0.Value =1 Then
   tag3.Write tag2.Value
   tag0.Write 0
End If

Else
   tag0.Write 1
End if
End Function

提问者对于答案的评价:
多谢多谢!也非常感谢大家的回答!

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

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

相关推荐