怎么检测WinCC与PLC的通信状态

怎么检测WinCC与PLC的通信状态,当通信断开时在报警中显示“通信中断”,通信再次连接正常时在报警中显示“通信连接”,并计算出中间的间隔时间

最佳答案

可以将信号质量状态取出,进行编程。
#include "apdefap.h" 

int gscAction( void )

unsigned long status[1]; 

GetTagBitState("S7$Program(1)_Switch",&status[0]); //Return type :short int printf("%d",*status); 

if (*status==1)
SetTagBit("ConnectionBool",1); //Return type :BOOL
else
SetTagBit("ConnectionBool",0); //Return type :BOOL 

return(0);

提问者对于答案的评价:
谢谢了,不错,很好

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

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

相关推荐