You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
530 B
48 lines
530 B
FUNCTION_BLOCK BS_DevHeart
|
|
VAR_EXTERNAL
|
|
|
|
END_VAR
|
|
|
|
VAR_INPUT
|
|
|
|
END_VAR
|
|
|
|
VAR_OUTPUT
|
|
HeartVavle :int;
|
|
END_VAR
|
|
|
|
VAR
|
|
ton1 :ton;
|
|
END_VAR
|
|
|
|
(*
|
|
|
|
时 间:20191003
|
|
版 本:1.0
|
|
作 者:姚立
|
|
名 称:设备心跳存活程序
|
|
说 明:用于判断设备是否存活的心跳程序
|
|
备 注:
|
|
依赖块:无
|
|
|
|
*)
|
|
|
|
(*
|
|
|
|
Output_Type 输出
|
|
心跳数据0-99
|
|
|
|
*)
|
|
ton1(pt:=t#2s);
|
|
ton1.in:=not ton1.q;
|
|
if ton1.q=1 then
|
|
HeartVavle :=HeartVavle+1;
|
|
end_if;
|
|
if HeartVavle =99 then
|
|
HeartVavle:=0;
|
|
end_if;
|
|
|
|
|
|
|
|
|
|
END_FUNCTION_BLOCK
|