Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added BOOLS_TO_XX.fct files to utils-1.0.0 #239

Merged
merged 12 commits into from
Aug 16, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<Function Name="ASSEMBLE_BYTE_FROM_BOOLS" Comment="">
<Identification Standard="61499-1" Description="Copyright (c) 2024 HR Agrartechnik GmbH &#10; &#10;This program and the accompanying materials are made &#10;available under the terms of the Eclipse Public License 2.0 &#10;which is available at https://www.eclipse.org/legal/epl-2.0/ &#10; &#10;SPDX-License-Identifier: EPL-2.0" >
</Identification>
<VersionInfo Version="1.0" Author="franz" Date="2024-02-22">
</VersionInfo>
<CompilerInfo>
</CompilerInfo>
<InterfaceList>
<EventInputs>
<Event Name="REQ" Type="Event" Comment="">
<With Var="IN_00"/>
<With Var="IN_01"/>
<With Var="IN_02"/>
<With Var="IN_03"/>
<With Var="IN_04"/>
<With Var="IN_05"/>
<With Var="IN_06"/>
<With Var="IN_07"/>
</Event>
</EventInputs>
<EventOutputs>
<Event Name="CNF" Type="Event" Comment="">
<With Var=""/>
</Event>
</EventOutputs>
<InputVars>
<VarDeclaration Name="IN_00" Type="BOOL" Comment="BIT 00"/>
<VarDeclaration Name="IN_01" Type="BOOL" Comment="BIT 01"/>
<VarDeclaration Name="IN_02" Type="BOOL" Comment="BIT 02"/>
<VarDeclaration Name="IN_03" Type="BOOL" Comment="BIT 03"/>
<VarDeclaration Name="IN_04" Type="BOOL" Comment="BIT 04"/>
<VarDeclaration Name="IN_05" Type="BOOL" Comment="BIT 05"/>
<VarDeclaration Name="IN_06" Type="BOOL" Comment="BIT 06"/>
<VarDeclaration Name="IN_07" Type="BOOL" Comment="BIT 07"/>
</InputVars>
<OutputVars>
<VarDeclaration Name="" Type="BYTE" Comment=""/>
</OutputVars>
</InterfaceList>
<FunctionBody>
<ST><![CDATA[FUNCTION ASSEMBLE_BYTE_FROM_BOOLS : BYTE

VAR_INPUT
IN_00 : BOOL; // BIT 00
IN_01 : BOOL; // BIT 01
IN_02 : BOOL; // BIT 02
IN_03 : BOOL; // BIT 03
IN_04 : BOOL; // BIT 04
IN_05 : BOOL; // BIT 05
IN_06 : BOOL; // BIT 06
IN_07 : BOOL; // BIT 07
END_VAR

(* this Function combines the 8 BOOLS to a byte *)
MoritzO02 marked this conversation as resolved.
Show resolved Hide resolved
ASSEMBLE_BYTE_FROM_BOOLS.%X0 := IN_00;
ASSEMBLE_BYTE_FROM_BOOLS.%X1 := IN_01;
ASSEMBLE_BYTE_FROM_BOOLS.%X2 := IN_02;
ASSEMBLE_BYTE_FROM_BOOLS.%X3 := IN_03;
ASSEMBLE_BYTE_FROM_BOOLS.%X4 := IN_04;
ASSEMBLE_BYTE_FROM_BOOLS.%X5 := IN_05;
ASSEMBLE_BYTE_FROM_BOOLS.%X6 := IN_06;
ASSEMBLE_BYTE_FROM_BOOLS.%X7 := IN_07;

END_FUNCTION
]]></ST>
</FunctionBody>
</Function>
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<Function Name="ASSEMBLE_DWORD_FROM_BOOLS" Comment="">
<Identification Standard="61499-1" Description="Copyright (c) 2024 HR Agrartechnik GmbH &#10; &#10;This program and the accompanying materials are made &#10;available under the terms of the Eclipse Public License 2.0 &#10;which is available at https://www.eclipse.org/legal/epl-2.0/ &#10; &#10;SPDX-License-Identifier: EPL-2.0" >
</Identification>
<VersionInfo Version="1.0" Author="franz" Date="2024-02-22">
</VersionInfo>
<CompilerInfo>
</CompilerInfo>
<InterfaceList>
<EventInputs>
<Event Name="REQ" Type="Event" Comment="">
<With Var="IN_00"/>
<With Var="IN_01"/>
<With Var="IN_02"/>
<With Var="IN_03"/>
<With Var="IN_04"/>
<With Var="IN_05"/>
<With Var="IN_06"/>
<With Var="IN_07"/>
<With Var="IN_08"/>
<With Var="IN_09"/>
<With Var="IN_10"/>
<With Var="IN_11"/>
<With Var="IN_12"/>
<With Var="IN_13"/>
<With Var="IN_14"/>
<With Var="IN_15"/>
<With Var="IN_16"/>
<With Var="IN_17"/>
<With Var="IN_18"/>
<With Var="IN_19"/>
<With Var="IN_20"/>
<With Var="IN_21"/>
<With Var="IN_22"/>
<With Var="IN_23"/>
<With Var="IN_24"/>
<With Var="IN_25"/>
<With Var="IN_26"/>
<With Var="IN_27"/>
<With Var="IN_28"/>
<With Var="IN_29"/>
<With Var="IN_30"/>
<With Var="IN_31"/>
</Event>
</EventInputs>
<EventOutputs>
<Event Name="CNF" Type="Event" Comment="">
<With Var=""/>
</Event>
</EventOutputs>
<InputVars>
<VarDeclaration Name="IN_00" Type="BOOL" Comment="BIT 00"/>
<VarDeclaration Name="IN_01" Type="BOOL" Comment="BIT 01"/>
<VarDeclaration Name="IN_02" Type="BOOL" Comment="BIT 02"/>
<VarDeclaration Name="IN_03" Type="BOOL" Comment="BIT 03"/>
<VarDeclaration Name="IN_04" Type="BOOL" Comment="BIT 04"/>
<VarDeclaration Name="IN_05" Type="BOOL" Comment="BIT 05"/>
<VarDeclaration Name="IN_06" Type="BOOL" Comment="BIT 06"/>
<VarDeclaration Name="IN_07" Type="BOOL" Comment="BIT 07"/>
<VarDeclaration Name="IN_08" Type="BOOL" Comment="BIT 08"/>
<VarDeclaration Name="IN_09" Type="BOOL" Comment="BIT 09"/>
<VarDeclaration Name="IN_10" Type="BOOL" Comment="BIT 10"/>
<VarDeclaration Name="IN_11" Type="BOOL" Comment="BIT 11"/>
<VarDeclaration Name="IN_12" Type="BOOL" Comment="BIT 12"/>
<VarDeclaration Name="IN_13" Type="BOOL" Comment="BIT 13"/>
<VarDeclaration Name="IN_14" Type="BOOL" Comment="BIT 14"/>
<VarDeclaration Name="IN_15" Type="BOOL" Comment="BIT 15"/>
<VarDeclaration Name="IN_16" Type="BOOL" Comment="BIT 16"/>
<VarDeclaration Name="IN_17" Type="BOOL" Comment="BIT 17"/>
<VarDeclaration Name="IN_18" Type="BOOL" Comment="BIT 18"/>
<VarDeclaration Name="IN_19" Type="BOOL" Comment="BIT 19"/>
<VarDeclaration Name="IN_20" Type="BOOL" Comment="BIT 20"/>
<VarDeclaration Name="IN_21" Type="BOOL" Comment="BIT 21"/>
<VarDeclaration Name="IN_22" Type="BOOL" Comment="BIT 22"/>
<VarDeclaration Name="IN_23" Type="BOOL" Comment="BIT 23"/>
<VarDeclaration Name="IN_24" Type="BOOL" Comment="BIT 24"/>
<VarDeclaration Name="IN_25" Type="BOOL" Comment="BIT 25"/>
<VarDeclaration Name="IN_26" Type="BOOL" Comment="BIT 26"/>
<VarDeclaration Name="IN_27" Type="BOOL" Comment="BIT 27"/>
<VarDeclaration Name="IN_28" Type="BOOL" Comment="BIT 28"/>
<VarDeclaration Name="IN_29" Type="BOOL" Comment="BIT 29"/>
<VarDeclaration Name="IN_30" Type="BOOL" Comment="BIT 30"/>
<VarDeclaration Name="IN_31" Type="BOOL" Comment="BIT 31"/>
</InputVars>
<OutputVars>
<VarDeclaration Name="" Type="DWORD" Comment=""/>
</OutputVars>
</InterfaceList>
<FunctionBody>
<ST><![CDATA[FUNCTION ASSEMBLE_DWORD_FROM_BOOLS : DWORD

VAR_INPUT
IN_00 : BOOL; // BIT 00
IN_01 : BOOL; // BIT 01
IN_02 : BOOL; // BIT 02
IN_03 : BOOL; // BIT 03
IN_04 : BOOL; // BIT 04
IN_05 : BOOL; // BIT 05
IN_06 : BOOL; // BIT 06
IN_07 : BOOL; // BIT 07
IN_08 : BOOL; // BIT 08
IN_09 : BOOL; // BIT 09
IN_10 : BOOL; // BIT 10
IN_11 : BOOL; // BIT 11
IN_12 : BOOL; // BIT 12
IN_13 : BOOL; // BIT 13
IN_14 : BOOL; // BIT 14
IN_15 : BOOL; // BIT 15
IN_16 : BOOL; // BIT 16
IN_17 : BOOL; // BIT 17
IN_18 : BOOL; // BIT 18
IN_19 : BOOL; // BIT 19
IN_20 : BOOL; // BIT 20
IN_21 : BOOL; // BIT 21
IN_22 : BOOL; // BIT 22
IN_23 : BOOL; // BIT 23
IN_24 : BOOL; // BIT 24
IN_25 : BOOL; // BIT 25
IN_26 : BOOL; // BIT 26
IN_27 : BOOL; // BIT 27
IN_28 : BOOL; // BIT 28
IN_29 : BOOL; // BIT 29
IN_30 : BOOL; // BIT 30
IN_31 : BOOL; // BIT 31
END_VAR

(* this Function combines the 32 BOOLS to a dword *)
MoritzO02 marked this conversation as resolved.
Show resolved Hide resolved
ASSEMBLE_DWORD_FROM_BOOLS.%X0 := IN_00;
ASSEMBLE_DWORD_FROM_BOOLS.%X1 := IN_01;
ASSEMBLE_DWORD_FROM_BOOLS.%X2 := IN_02;
ASSEMBLE_DWORD_FROM_BOOLS.%X3 := IN_03;
ASSEMBLE_DWORD_FROM_BOOLS.%X4 := IN_04;
ASSEMBLE_DWORD_FROM_BOOLS.%X5 := IN_05;
ASSEMBLE_DWORD_FROM_BOOLS.%X6 := IN_06;
ASSEMBLE_DWORD_FROM_BOOLS.%X7 := IN_07;
ASSEMBLE_DWORD_FROM_BOOLS.%X8 := IN_08;
ASSEMBLE_DWORD_FROM_BOOLS.%X9 := IN_09;
ASSEMBLE_DWORD_FROM_BOOLS.%X10 := IN_10;
ASSEMBLE_DWORD_FROM_BOOLS.%X11 := IN_11;
ASSEMBLE_DWORD_FROM_BOOLS.%X12 := IN_12;
ASSEMBLE_DWORD_FROM_BOOLS.%X13 := IN_13;
ASSEMBLE_DWORD_FROM_BOOLS.%X14 := IN_14;
ASSEMBLE_DWORD_FROM_BOOLS.%X15 := IN_15;
ASSEMBLE_DWORD_FROM_BOOLS.%X16 := IN_16;
ASSEMBLE_DWORD_FROM_BOOLS.%X17 := IN_17;
ASSEMBLE_DWORD_FROM_BOOLS.%X18 := IN_18;
ASSEMBLE_DWORD_FROM_BOOLS.%X19 := IN_19;
ASSEMBLE_DWORD_FROM_BOOLS.%X20 := IN_20;
ASSEMBLE_DWORD_FROM_BOOLS.%X21 := IN_21;
ASSEMBLE_DWORD_FROM_BOOLS.%X22 := IN_22;
ASSEMBLE_DWORD_FROM_BOOLS.%X23 := IN_23;
ASSEMBLE_DWORD_FROM_BOOLS.%X24 := IN_24;
ASSEMBLE_DWORD_FROM_BOOLS.%X25 := IN_25;
ASSEMBLE_DWORD_FROM_BOOLS.%X26 := IN_26;
ASSEMBLE_DWORD_FROM_BOOLS.%X27 := IN_27;
ASSEMBLE_DWORD_FROM_BOOLS.%X28 := IN_28;
ASSEMBLE_DWORD_FROM_BOOLS.%X29 := IN_29;
ASSEMBLE_DWORD_FROM_BOOLS.%X30 := IN_30;
ASSEMBLE_DWORD_FROM_BOOLS.%X31 := IN_31;
END_FUNCTION
]]></ST>
</FunctionBody>
</Function>
Loading
Loading