找答案的高端用户(找答案钻石及双钻级别的用户)将尽可能从此问题下的所有回
答中,为您推荐最佳答案。届时您可以根据推荐数采纳答案。
如果自提问时间起7天内您仍无法选出最佳答案,您可以选择“无满意答案”关闭此问题。
在下位机做如果1357运行=m0.0,如果2468运行=m0.1,上位机建立变量tag1连接m0.0,tag2连接m0.1.如果你的电机运行和停止的不是你设定的怎么办?显示第三种颜色。
方框的背景颜色c脚本:
define TAG_1 "tag1"
define TAG_2 "tag2"
if((unsigned long)GetTagDouble(TAG_1))
return 65280;//绿色
else if((unsigned long)GetTagDouble(TAG_2))
return 255;//红色
else return 0;//其他颜色
脚本的触发变量连接tag1和tag2
vbs脚本:
function backcolor_trigger(byval item)
dim tag_1,tag_2
tag_1=hmiruntime.tags("tag1").read
tag_2=hmiruntime.tags("tag2").read
if tag_1 then
backcolor_trigger=65280
end if
if tag_2 then
backcolor_trigger=255
end if
if not tag_1 and not tag_2 then
backcolor_trigger=0
end if
end function
脚本触发变量添加tag1和tag2
如果你把8个信号全部取上来的话用vbs做简单:
dim tag_1,tag_2,tag_3,tag_4,tag_5,tag_6,tag_7,tag_8
tag_1=hmiruntime.tags("tag1").read
tag_2=hmiruntime.tags("tag2").read
tag_3=hmiruntime.tags("tag3").read
tag_4=hmiruntime.tags("tag4").read
tag_5=hmiruntime.tags("tag5").read
tag_6=hmiruntime.tags("tag6").read
tag_7=hmiruntime.tags("tag7").read
tag_8=hmiruntime.tags("tag8").read
if tag_1 and tag_3 and tag_5 and tag_7 then
backcolor_trigger=65280
end if
if tag_2 and tag_4 and tag_6 and tag_8 then
backcolor_trigger=255
end if
if not(tag_1 and tag_3 and tag_5 and tag_7) and not(tag_2 and tag_4 and tag_6 and tag_8) then
backcolor_trigger=0
end if
触发变量为tag1~tag8
首次回答问题,获得
双倍西币积分!
立即成为技术知识分享的一员!
找答案微信小程序
提问
搜索
欢迎您访问支持中心!
丰富的视频,全方位的文档,大量的网友交流精华……
为了更好的完善这些内容,我们诚邀您在浏览结束后,花20秒左右的时间,完成一个用户在线调查!
感谢您的支持!