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.
105 lines
2.3 KiB
105 lines
2.3 KiB
FUNCTION_BLOCK BS_GroupVavle
|
|
VAR_EXTERNAL
|
|
|
|
END_VAR
|
|
|
|
VAR_INPUT
|
|
LOCK :INT:=0;
|
|
BOOL_GroupSet:BOOL;
|
|
INT_GroupSet:INT;
|
|
REAL_GroupSet:REAL;
|
|
END_VAR
|
|
|
|
VAR_OUTPUT
|
|
REAL_OUT :ARRAY[0..10] OF REAL;
|
|
INT_OUT :ARRAY[0..10] OF INT;
|
|
BOOL_OUT :ARRAY[0..10] OF BOOL;
|
|
END_VAR
|
|
|
|
VAR
|
|
REAL_GroupSetP :REAL;
|
|
BOOL_GroupSetP :BOOL;
|
|
INT_GroupSetP :INT;
|
|
END_VAR
|
|
|
|
(*
|
|
|
|
时 间:20191008
|
|
版 本:1.5
|
|
作 者:姚立
|
|
名 称:变量批量赋值
|
|
说 明:用于变量批量赋值,可选锁定单体变量输入
|
|
LOCK 0均不锁定;1锁定BOOL;2,锁定INT;3,锁定REAL;
|
|
备 注:支持10组BOOL,10组REAL,10组INT
|
|
依赖块:无
|
|
|
|
*)
|
|
(**********一个REAL型总变量对10个变量赋值,10个变量也可单独赋值*************)
|
|
|
|
if REAL_GroupSet<>REAL_GroupSetP then
|
|
REAL_OUT[01]:=REAL_GroupSet;
|
|
REAL_OUT[02]:=REAL_GroupSet;
|
|
REAL_OUT[03]:=REAL_GroupSet;
|
|
REAL_OUT[04]:=REAL_GroupSet;
|
|
REAL_OUT[05]:=REAL_GroupSet;
|
|
REAL_OUT[06]:=REAL_GroupSet;
|
|
REAL_OUT[07]:=REAL_GroupSet;
|
|
REAL_OUT[08]:=REAL_GroupSet;
|
|
REAL_OUT[09]:=REAL_GroupSet;
|
|
REAL_OUT[10]:=REAL_GroupSet;
|
|
|
|
end_if;
|
|
|
|
|
|
(**********一个BOOL型总变量对10个变量赋值,10个变量也可单独赋值*************)
|
|
|
|
if BOOL_GroupSet<>BOOL_GroupSetP then
|
|
BOOL_OUT[01]:=BOOL_GroupSet;
|
|
BOOL_OUT[02]:=BOOL_GroupSet;
|
|
BOOL_OUT[03]:=BOOL_GroupSet;
|
|
BOOL_OUT[04]:=BOOL_GroupSet;
|
|
BOOL_OUT[05]:=BOOL_GroupSet;
|
|
BOOL_OUT[06]:=BOOL_GroupSet;
|
|
BOOL_OUT[07]:=BOOL_GroupSet;
|
|
BOOL_OUT[08]:=BOOL_GroupSet;
|
|
BOOL_OUT[09]:=BOOL_GroupSet;
|
|
BOOL_OUT[10]:=BOOL_GroupSet;
|
|
|
|
end_if;
|
|
|
|
|
|
(**********一个INT型总变量对10个变量赋值,10个变量也可单独赋值*************)
|
|
|
|
if INT_GroupSet<>INT_GroupSetP then
|
|
INT_OUT[01]:=INT_GroupSet;
|
|
INT_OUT[02]:=INT_GroupSet;
|
|
INT_OUT[03]:=INT_GroupSet;
|
|
INT_OUT[04]:=INT_GroupSet;
|
|
INT_OUT[05]:=INT_GroupSet;
|
|
INT_OUT[06]:=INT_GroupSet;
|
|
INT_OUT[07]:=INT_GroupSet;
|
|
INT_OUT[08]:=INT_GroupSet;
|
|
INT_OUT[09]:=INT_GroupSet;
|
|
INT_OUT[10]:=INT_GroupSet;
|
|
|
|
end_if;
|
|
|
|
case lock of
|
|
(*0时,均不锁定,1锁定BOOL;2,锁定INT;3,锁定REAL;*)
|
|
0:
|
|
BOOL_GroupSetP:=BOOL_GroupSet;
|
|
INT_GroupSetP:=INT_GroupSet;
|
|
REAL_GroupSetP:=REAL_GroupSet;
|
|
1:
|
|
INT_GroupSetP:=INT_GroupSet;
|
|
REAL_GroupSetP:=REAL_GroupSet;
|
|
2:
|
|
BOOL_GroupSetP:=BOOL_GroupSet;
|
|
REAL_GroupSetP:=REAL_GroupSet;
|
|
3:
|
|
BOOL_GroupSetP:=BOOL_GroupSet;
|
|
INT_GroupSetP:=INT_GroupSet;
|
|
end_case;
|
|
|
|
|
|
END_FUNCTION_BLOCK
|