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.
122 lines
2.0 KiB
122 lines
2.0 KiB
6 days ago
|
FUNCTION_BLOCK MBDI
|
||
|
VAR_EXTERNAL
|
||
|
|
||
|
END_VAR
|
||
|
|
||
|
VAR_INPUT
|
||
|
|
||
|
mbdi1 :bool;
|
||
|
mbdi2 :bool;
|
||
|
mbdi3 :bool;
|
||
|
mbdi4 :bool;
|
||
|
mbdi5 :bool;
|
||
|
mbdi6 :bool;
|
||
|
mbdi7 :bool;
|
||
|
mbdi8 :bool;
|
||
|
light1_in :bool;
|
||
|
light2_in :bool;
|
||
|
light3_in :bool;
|
||
|
light4_in :bool;
|
||
|
light5_in :bool;
|
||
|
light6_in :bool;
|
||
|
light7_in :bool;
|
||
|
light8_in :bool;
|
||
|
light9_in :bool;
|
||
|
light10_in :bool;
|
||
|
light11_in :bool;
|
||
|
light12_in :bool;
|
||
|
light_timer :time:=t#5S;
|
||
|
|
||
|
END_VAR
|
||
|
|
||
|
VAR_OUTPUT
|
||
|
|
||
|
light1_out :bool;
|
||
|
light2_out :bool;
|
||
|
light3_out :bool;
|
||
|
light4_out :bool;
|
||
|
light5_out :bool;
|
||
|
light6_out :bool;
|
||
|
light7_out :bool;
|
||
|
light8_out :bool;
|
||
|
light9_out :bool;
|
||
|
light10_out :bool;
|
||
|
light11_out :bool;
|
||
|
light12_out :bool;
|
||
|
|
||
|
END_VAR
|
||
|
|
||
|
VAR
|
||
|
|
||
|
light :bool;
|
||
|
lightm :bool;
|
||
|
light_mb :bool;
|
||
|
light_tof :tof;
|
||
|
|
||
|
light1 :bool;
|
||
|
light2 :bool;
|
||
|
light3 :bool;
|
||
|
light4 :bool;
|
||
|
light5 :bool;
|
||
|
light6 :bool;
|
||
|
light7 :bool;
|
||
|
light8 :bool;
|
||
|
light9 :bool;
|
||
|
light10 :bool;
|
||
|
light11 :bool;
|
||
|
light12 :bool;
|
||
|
|
||
|
|
||
|
END_VAR
|
||
|
|
||
|
light1:=light1_in;
|
||
|
light2:=light2_in;
|
||
|
light3:=light3_in;
|
||
|
light4:=light4_in;
|
||
|
light5:=light5_in;
|
||
|
light6:=light6_in;
|
||
|
light7:=light7_in;
|
||
|
light8:=light8_in;
|
||
|
light9:=light9_in;
|
||
|
light10:=light10_in;
|
||
|
light11:=light11_in;
|
||
|
light12:=light12_in;
|
||
|
|
||
|
if mbdi1=1 or mbdi2=1 or mbdi3=1 or mbdi4=1 or mbdi5=1 or mbdi6=1 or mbdi7=1 or mbdi8=1 then
|
||
|
light_mb:=1;
|
||
|
light:=1;
|
||
|
else light_mb:=0;
|
||
|
end_if;
|
||
|
|
||
|
light_tof( IN :=light_mb ,PT := light_timer | light:= Q );
|
||
|
if light<>lightm then
|
||
|
light1:=light;
|
||
|
light2:=light;
|
||
|
light3:=light;
|
||
|
light4:=light;
|
||
|
light5:=light;
|
||
|
light6:=light;
|
||
|
light7:=light;
|
||
|
light8:=light;
|
||
|
light9:=light;
|
||
|
light10:=light;
|
||
|
light11:=light;
|
||
|
light12:=light;
|
||
|
lightm:=light;
|
||
|
end_if;
|
||
|
|
||
|
light1_out:=light1;
|
||
|
light2_out:=light2;
|
||
|
light3_out:=light3;
|
||
|
light4_out:=light4;
|
||
|
light5_out:=light5;
|
||
|
light6_out:=light6;
|
||
|
light7_out:=light7;
|
||
|
light8_out:=light8;
|
||
|
light9_out:=light9;
|
||
|
light10_out:=light10;
|
||
|
light11_out:=light11;
|
||
|
light12_out:=light12;
|
||
|
|
||
|
|
||
|
END_FUNCTION_BLOCK
|