andrej@1552: <?xml version='1.0' encoding='utf-8'?>
andrej@1552: <project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
andrej@1552:   <fileHeader companyName="Beremiz" productName="Beremiz" productVersion="1" creationDateTime="2016-10-24T18:09:22"/>
andrej@1552:   <contentHeader name="First Steps" modificationDateTime="2016-10-26T20:18:02">
andrej@1552:     <coordinateInfo>
andrej@1552:       <fbd>
andrej@1552:         <scaling x="0" y="0"/>
andrej@1552:       </fbd>
andrej@1552:       <ld>
andrej@1552:         <scaling x="0" y="0"/>
andrej@1552:       </ld>
andrej@1552:       <sfc>
andrej@1552:         <scaling x="0" y="0"/>
andrej@1552:       </sfc>
andrej@1552:     </coordinateInfo>
andrej@1552:   </contentHeader>
andrej@1552:   <types>
andrej@1552:     <dataTypes/>
andrej@1552:     <pous>
andrej@1552:       <pou name="plc_prg" pouType="program">
andrej@1552:         <interface>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="Cnt1">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="Cnt2">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="Cnt3">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="Cnt4">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="Cnt5">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <localVars>
andrej@1552:             <variable name="CounterST0">
andrej@1552:               <type>
andrej@1552:                 <derived name="CounterST"/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="CounterFBD0">
andrej@1552:               <type>
andrej@1552:                 <derived name="CounterFBD"/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="CounterSFC0">
andrej@1552:               <type>
andrej@1552:                 <derived name="CounterSFC"/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="CounterIL0">
andrej@1552:               <type>
andrej@1552:                 <derived name="CounterIL"/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:             <variable name="CounterLD0">
andrej@1552:               <type>
andrej@1552:                 <derived name="CounterLD"/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:         </interface>
andrej@1552:         <body>
andrej@1552:           <FBD>
andrej@1552:             <block localId="1" typeName="CounterST" instanceName="CounterST0" executionOrderId="0" height="60" width="125">
andrej@1552:               <position x="207" y="53"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="Reset">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="40"/>
andrej@1552:                     <connection refLocalId="2">
andrej@1552:                       <position x="207" y="93"/>
andrej@1552:                       <position x="114" y="93"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="125" y="40"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <inVariable localId="2" executionOrderId="0" height="24" width="79" negated="false">
andrej@1552:               <position x="35" y="81"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="79" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:             <outVariable localId="3" executionOrderId="0" height="24" width="106" negated="false">
andrej@1552:               <position x="424" y="81"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="1" formalParameter="OUT">
andrej@1552:                   <position x="424" y="93"/>
andrej@1552:                   <position x="332" y="93"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Cnt1</expression>
andrej@1552:             </outVariable>
andrej@1552:             <block localId="4" typeName="CounterFBD" instanceName="CounterFBD0" executionOrderId="0" height="54" width="121">
andrej@1552:               <position x="211" y="145"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="Reset">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="37"/>
andrej@1552:                     <connection refLocalId="13">
andrej@1552:                       <position x="211" y="182"/>
andrej@1552:                       <position x="115" y="182"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="121" y="37"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <outVariable localId="5" executionOrderId="0" height="24" width="103" negated="false">
andrej@1552:               <position x="426" y="170"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="4" formalParameter="OUT">
andrej@1552:                   <position x="426" y="182"/>
andrej@1552:                   <position x="332" y="182"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Cnt2</expression>
andrej@1552:             </outVariable>
andrej@1552:             <comment localId="6" height="264" width="417">
andrej@1552:               <position x="569" y="55"/>
andrej@1552:               <content>
andrej@1552:                 <xhtml:p><![CDATA[In this example function block with the same functionality 
andrej@1552: is created using all five IEC 61131-3 programing languages:
andrej@1552: - IL;
andrej@1552: - FBD;
andrej@1552: - LD;
andrej@1552: - ST;
andrej@1552: - SFC.
andrej@1552: 
andrej@1552: 
andrej@1552: 
andrej@1552: 
andrej@1552: Function block is a counter with reset control input.
andrej@1552: If reset is True counter value is reset to the value defined by
andrej@1552: global configuration constant ResetCounterValue. 
andrej@1552: If reset is False, counter is incremented every cycle.
andrej@1552: ]]></xhtml:p>
andrej@1552:               </content>
andrej@1552:             </comment>
andrej@1552:             <block localId="7" typeName="CounterSFC" instanceName="CounterSFC0" executionOrderId="0" height="52" width="121">
andrej@1552:               <position x="211" y="237"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="Reset">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="36"/>
andrej@1552:                     <connection refLocalId="12">
andrej@1552:                       <position x="211" y="273"/>
andrej@1552:                       <position x="103" y="273"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="121" y="36"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <outVariable localId="8" executionOrderId="0" height="24" width="97" negated="false">
andrej@1552:               <position x="431" y="261"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="7" formalParameter="OUT">
andrej@1552:                   <position x="431" y="273"/>
andrej@1552:                   <position x="332" y="273"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Cnt3</expression>
andrej@1552:             </outVariable>
andrej@1552:             <block localId="9" typeName="CounterIL" instanceName="CounterIL0" executionOrderId="0" height="62" width="121">
andrej@1552:               <position x="211" y="322"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="Reset">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="41"/>
andrej@1552:                     <connection refLocalId="10">
andrej@1552:                       <position x="211" y="363"/>
andrej@1552:                       <position x="101" y="363"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="121" y="41"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <inVariable localId="10" executionOrderId="0" height="24" width="67" negated="false">
andrej@1552:               <position x="34" y="351"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="67" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:             <outVariable localId="11" executionOrderId="0" height="24" width="91" negated="false">
andrej@1552:               <position x="434" y="351"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="9" formalParameter="OUT">
andrej@1552:                   <position x="434" y="363"/>
andrej@1552:                   <position x="332" y="363"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Cnt4</expression>
andrej@1552:             </outVariable>
andrej@1552:             <inVariable localId="12" executionOrderId="0" height="24" width="67" negated="false">
andrej@1552:               <position x="36" y="261"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="67" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:             <inVariable localId="13" executionOrderId="0" height="24" width="79" negated="false">
andrej@1552:               <position x="36" y="170"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="79" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:             <block localId="14" typeName="CounterLD" instanceName="CounterLD0" executionOrderId="0" height="62" width="124">
andrej@1552:               <position x="210" y="411"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="Reset">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="41"/>
andrej@1552:                     <connection refLocalId="16">
andrej@1552:                       <position x="210" y="452"/>
andrej@1552:                       <position x="100" y="452"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="Out">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="124" y="41"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <outVariable localId="15" executionOrderId="0" height="24" width="88" negated="false">
andrej@1552:               <position x="437" y="440"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="14" formalParameter="Out">
andrej@1552:                   <position x="437" y="452"/>
andrej@1552:                   <position x="334" y="452"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Cnt5</expression>
andrej@1552:             </outVariable>
andrej@1552:             <inVariable localId="16" executionOrderId="0" height="24" width="64" negated="false">
andrej@1552:               <position x="36" y="440"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="64" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:           </FBD>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:       <pou name="CounterST" pouType="functionBlock">
andrej@1552:         <interface>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <localVars>
andrej@1552:             <variable name="Cnt">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="OUT">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <externalVars constant="true">
andrej@1552:             <variable name="ResetCounterValue">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </externalVars>
andrej@1552:         </interface>
andrej@1552:         <body>
andrej@1552:           <ST>
andrej@1552:             <xhtml:p><![CDATA[IF Reset THEN
andrej@1552:   Cnt := ResetCounterValue;
andrej@1552: ELSE
andrej@1552:   Cnt := Cnt + 1;
andrej@1552: END_IF;
andrej@1552: 
andrej@1552: Out := Cnt;]]></xhtml:p>
andrej@1552:           </ST>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:       <pou name="CounterFBD" pouType="functionBlock">
andrej@1552:         <interface>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="OUT">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <localVars>
andrej@1552:             <variable name="Cnt">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:           <externalVars constant="true">
andrej@1552:             <variable name="ResetCounterValue">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </externalVars>
andrej@1552:         </interface>
andrej@1552:         <body>
andrej@1552:           <FBD>
andrej@1552:             <inVariable localId="1" executionOrderId="0" height="24" width="61" negated="false">
andrej@1552:               <position x="321" y="58"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="61" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Reset</expression>
andrej@1552:             </inVariable>
andrej@1552:             <outVariable localId="2" executionOrderId="0" height="24" width="34" negated="false">
andrej@1552:               <position x="675" y="137"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="3">
andrej@1552:                   <position x="675" y="149"/>
andrej@1552:                   <position x="586" y="149"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>OUT</expression>
andrej@1552:             </outVariable>
andrej@1552:             <inOutVariable localId="3" executionOrderId="0" height="24" width="29" negatedOut="false" negatedIn="false">
andrej@1552:               <position x="557" y="137"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="7" formalParameter="OUT">
andrej@1552:                   <position x="557" y="149"/>
andrej@1552:                   <position x="524" y="149"/>
andrej@1552:                   <position x="524" y="130"/>
andrej@1552:                   <position x="505" y="130"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="29" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Cnt</expression>
andrej@1552:             </inOutVariable>
andrej@1552:             <block localId="4" typeName="ADD" executionOrderId="0" height="80" width="57">
andrej@1552:               <position x="328" y="115"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="IN1">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="35"/>
andrej@1552:                     <connection refLocalId="6">
andrej@1552:                       <position x="328" y="150"/>
andrej@1552:                       <position x="275" y="150"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN2">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="65"/>
andrej@1552:                     <connection refLocalId="3">
andrej@1552:                       <position x="328" y="180"/>
andrej@1552:                       <position x="317" y="180"/>
andrej@1552:                       <position x="317" y="213"/>
andrej@1552:                       <position x="596" y="213"/>
andrej@1552:                       <position x="596" y="149"/>
andrej@1552:                       <position x="586" y="149"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="57" y="35"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <inVariable localId="5" executionOrderId="0" height="24" width="158" negated="false">
andrej@1552:               <position x="222" y="256"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="158" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>ResetCounterValue</expression>
andrej@1552:             </inVariable>
andrej@1552:             <inVariable localId="6" executionOrderId="0" height="24" width="21" negated="false">
andrej@1552:               <position x="254" y="138"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="21" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>1</expression>
andrej@1552:             </inVariable>
andrej@1552:             <block localId="7" typeName="SEL" executionOrderId="0" height="80" width="57">
andrej@1552:               <position x="448" y="100"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="G">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="30"/>
andrej@1552:                     <connection refLocalId="1">
andrej@1552:                       <position x="448" y="130"/>
andrej@1552:                       <position x="415" y="130"/>
andrej@1552:                       <position x="415" y="70"/>
andrej@1552:                       <position x="382" y="70"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN0">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="50"/>
andrej@1552:                     <connection refLocalId="4" formalParameter="OUT">
andrej@1552:                       <position x="448" y="150"/>
andrej@1552:                       <position x="385" y="150"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN1">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="70"/>
andrej@1552:                     <connection refLocalId="5">
andrej@1552:                       <position x="448" y="170"/>
andrej@1552:                       <position x="414" y="170"/>
andrej@1552:                       <position x="414" y="268"/>
andrej@1552:                       <position x="380" y="268"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="57" y="30"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:           </FBD>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:       <pou name="CounterSFC" pouType="functionBlock">
andrej@1552:         <interface>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="OUT">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <localVars>
andrej@1552:             <variable name="Cnt">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:           <externalVars constant="true">
andrej@1552:             <variable name="ResetCounterValue">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </externalVars>
andrej@1552:         </interface>
andrej@1552:         <actions/>
andrej@1552:         <body>
andrej@1552:           <SFC>
andrej@1552:             <step localId="1" name="Start" initialStep="true" height="28" width="90">
andrej@1552:               <position x="241" y="14"/>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="45" y="28"/>
andrej@1552:               </connectionPointOut>
andrej@1552:             </step>
andrej@1552:             <selectionDivergence localId="2" height="1" width="431">
andrej@1552:               <position x="70" y="86"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="216" y="0"/>
andrej@1552:                 <connection refLocalId="1">
andrej@1552:                   <position x="286" y="86"/>
andrej@1552:                   <position x="286" y="42"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="0" y="1"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="431" y="1"/>
andrej@1552:               </connectionPointOut>
andrej@1552:             </selectionDivergence>
andrej@1552:             <transition localId="3" height="2" width="20">
andrej@1552:               <position x="491" y="132"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="10" y="0"/>
andrej@1552:                 <connection refLocalId="2">
andrej@1552:                   <position x="501" y="132"/>
andrej@1552:                   <position x="501" y="87"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="10" y="2"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <condition>
andrej@1552:                 <inline name="">
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[Reset]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </condition>
andrej@1552:             </transition>
andrej@1552:             <transition localId="4" height="2" width="20" executionOrderId="0">
andrej@1552:               <position x="60" y="135"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="10" y="0"/>
andrej@1552:                 <connection refLocalId="2">
andrej@1552:                   <position x="70" y="135"/>
andrej@1552:                   <position x="70" y="87"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="10" y="2"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <condition>
andrej@1552:                 <inline name="">
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[NOT Reset]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </condition>
andrej@1552:             </transition>
andrej@1552:             <step localId="5" name="ResetCounter" initialStep="false" height="24" width="104">
andrej@1552:               <position x="449" y="190"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="52" y="0"/>
andrej@1552:                 <connection refLocalId="3">
andrej@1552:                   <position x="501" y="190"/>
andrej@1552:                   <position x="501" y="134"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="52" y="24"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <connectionPointOutAction formalParameter="">
andrej@1552:                 <relPosition x="104" y="12"/>
andrej@1552:               </connectionPointOutAction>
andrej@1552:             </step>
andrej@1552:             <actionBlock localId="6" height="63" width="222">
andrej@1552:               <position x="600" y="187"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="15"/>
andrej@1552:                 <connection refLocalId="5">
andrej@1552:                   <position x="600" y="202"/>
andrej@1552:                   <position x="553" y="202"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <action localId="0">
andrej@1552:                 <relPosition x="0" y="0"/>
andrej@1552:                 <inline>
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[Cnt := ResetCounterValue;]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </action>
andrej@1552:               <action localId="0">
andrej@1552:                 <relPosition x="0" y="0"/>
andrej@1552:                 <inline>
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[OUT := Cnt;]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </action>
andrej@1552:             </actionBlock>
andrej@1552:             <step localId="7" name="Count" initialStep="false" height="24" width="85" executionOrderId="0">
andrej@1552:               <position x="28" y="191"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="42" y="0"/>
andrej@1552:                 <connection refLocalId="4">
andrej@1552:                   <position x="70" y="191"/>
andrej@1552:                   <position x="70" y="137"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="42" y="24"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <connectionPointOutAction formalParameter="">
andrej@1552:                 <relPosition x="85" y="12"/>
andrej@1552:               </connectionPointOutAction>
andrej@1552:             </step>
andrej@1552:             <actionBlock localId="8" height="52" width="148" executionOrderId="0">
andrej@1552:               <position x="135" y="188"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="15"/>
andrej@1552:                 <connection refLocalId="7">
andrej@1552:                   <position x="135" y="203"/>
andrej@1552:                   <position x="113" y="203"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <action localId="0">
andrej@1552:                 <relPosition x="0" y="0"/>
andrej@1552:                 <inline>
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[Cnt := Cnt + 1;]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </action>
andrej@1552:               <action localId="0">
andrej@1552:                 <relPosition x="0" y="0"/>
andrej@1552:                 <inline>
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[OUT := Cnt;]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </action>
andrej@1552:             </actionBlock>
andrej@1552:             <selectionConvergence localId="10" height="1" width="431">
andrej@1552:               <position x="70" y="273"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="0"/>
andrej@1552:                 <connection refLocalId="13">
andrej@1552:                   <position x="70" y="273"/>
andrej@1552:                   <position x="70" y="244"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="431" y="0"/>
andrej@1552:                 <connection refLocalId="14">
andrej@1552:                   <position x="501" y="273"/>
andrej@1552:                   <position x="501" y="250"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="216" y="1"/>
andrej@1552:               </connectionPointOut>
andrej@1552:             </selectionConvergence>
andrej@1552:             <jumpStep localId="12" targetName="Start" height="13" width="12">
andrej@1552:               <position x="280" y="317"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="6" y="0"/>
andrej@1552:                 <connection refLocalId="10">
andrej@1552:                   <position x="286" y="317"/>
andrej@1552:                   <position x="286" y="274"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:             </jumpStep>
andrej@1552:             <transition localId="13" height="2" width="20" executionOrderId="0">
andrej@1552:               <position x="60" y="242"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="10" y="0"/>
andrej@1552:                 <connection refLocalId="7">
andrej@1552:                   <position x="70" y="242"/>
andrej@1552:                   <position x="70" y="215"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="10" y="2"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <condition>
andrej@1552:                 <inline name="">
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[Reset]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </condition>
andrej@1552:             </transition>
andrej@1552:             <transition localId="14" height="2" width="20" executionOrderId="0">
andrej@1552:               <position x="491" y="248"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="10" y="0"/>
andrej@1552:                 <connection refLocalId="5">
andrej@1552:                   <position x="501" y="248"/>
andrej@1552:                   <position x="501" y="214"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="10" y="2"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <condition>
andrej@1552:                 <inline name="">
andrej@1552:                   <ST>
andrej@1552:                     <xhtml:p><![CDATA[NOT Reset]]></xhtml:p>
andrej@1552:                   </ST>
andrej@1552:                 </inline>
andrej@1552:               </condition>
andrej@1552:             </transition>
andrej@1552:           </SFC>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:       <pou name="CounterIL" pouType="functionBlock">
andrej@1552:         <interface>
andrej@1552:           <localVars>
andrej@1552:             <variable name="Cnt">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="OUT">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <externalVars constant="true">
andrej@1552:             <variable name="ResetCounterValue">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </externalVars>
andrej@1552:         </interface>
andrej@1552:         <body>
andrej@1552:           <IL>
andrej@1552:             <xhtml:p><![CDATA[LD Reset
andrej@1552: JMPC ResetCnt
andrej@1552: 
andrej@1552: (* increment counter *)
andrej@1552: LD Cnt
andrej@1552: ADD 1
andrej@1552: JMP QuitFb
andrej@1552: 
andrej@1552: ResetCnt:
andrej@1552: (* reset counter *)
andrej@1552: LD ResetCounterValue
andrej@1552: 
andrej@1552: QuitFb:
andrej@1552: (* save results *)
andrej@1552: ST Cnt
andrej@1552: ST Out
andrej@1552: ]]></xhtml:p>
andrej@1552:           </IL>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:       <pou name="CounterLD" pouType="functionBlock">
andrej@1552:         <interface>
andrej@1552:           <inputVars>
andrej@1552:             <variable name="Reset">
andrej@1552:               <type>
andrej@1552:                 <BOOL/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </inputVars>
andrej@1552:           <outputVars>
andrej@1552:             <variable name="Out">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </outputVars>
andrej@1552:           <localVars>
andrej@1552:             <variable name="Cnt">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </localVars>
andrej@1552:           <externalVars constant="true">
andrej@1552:             <variable name="ResetCounterValue">
andrej@1552:               <type>
andrej@1552:                 <INT/>
andrej@1552:               </type>
andrej@1552:             </variable>
andrej@1552:           </externalVars>
andrej@1552:         </interface>
andrej@1552:         <body>
andrej@1552:           <LD>
andrej@1552:             <outVariable localId="2" executionOrderId="0" height="24" width="34" negated="false">
andrej@1552:               <position x="527" y="90"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="3">
andrej@1552:                   <position x="527" y="102"/>
andrej@1552:                   <position x="438" y="102"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <expression>Out</expression>
andrej@1552:             </outVariable>
andrej@1552:             <inOutVariable localId="3" executionOrderId="0" height="24" width="29" negatedOut="false" negatedIn="false">
andrej@1552:               <position x="409" y="90"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="12"/>
andrej@1552:                 <connection refLocalId="7" formalParameter="OUT">
andrej@1552:                   <position x="409" y="102"/>
andrej@1552:                   <position x="357" y="102"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="29" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>Cnt</expression>
andrej@1552:             </inOutVariable>
andrej@1552:             <block localId="4" typeName="ADD" executionOrderId="0" height="80" width="57">
andrej@1552:               <position x="180" y="87"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="IN1">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="35"/>
andrej@1552:                     <connection refLocalId="6">
andrej@1552:                       <position x="180" y="122"/>
andrej@1552:                       <position x="127" y="122"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN2">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="65"/>
andrej@1552:                     <connection refLocalId="3">
andrej@1552:                       <position x="180" y="152"/>
andrej@1552:                       <position x="169" y="152"/>
andrej@1552:                       <position x="169" y="185"/>
andrej@1552:                       <position x="448" y="185"/>
andrej@1552:                       <position x="448" y="102"/>
andrej@1552:                       <position x="438" y="102"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="57" y="35"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <inVariable localId="5" executionOrderId="0" height="24" width="158" negated="false">
andrej@1552:               <position x="74" y="228"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="158" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>ResetCounterValue</expression>
andrej@1552:             </inVariable>
andrej@1552:             <inVariable localId="6" executionOrderId="0" height="24" width="21" negated="false">
andrej@1552:               <position x="106" y="110"/>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="21" y="12"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <expression>1</expression>
andrej@1552:             </inVariable>
andrej@1552:             <block localId="7" typeName="SEL" executionOrderId="0" height="80" width="57">
andrej@1552:               <position x="300" y="72"/>
andrej@1552:               <inputVariables>
andrej@1552:                 <variable formalParameter="G">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="30"/>
andrej@1552:                     <connection refLocalId="9">
andrej@1552:                       <position x="300" y="102"/>
andrej@1552:                       <position x="266" y="102"/>
andrej@1552:                       <position x="266" y="62"/>
andrej@1552:                       <position x="134" y="62"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN0">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="50"/>
andrej@1552:                     <connection refLocalId="4" formalParameter="OUT">
andrej@1552:                       <position x="300" y="122"/>
andrej@1552:                       <position x="237" y="122"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:                 <variable formalParameter="IN1">
andrej@1552:                   <connectionPointIn>
andrej@1552:                     <relPosition x="0" y="70"/>
andrej@1552:                     <connection refLocalId="5">
andrej@1552:                       <position x="300" y="142"/>
andrej@1552:                       <position x="266" y="142"/>
andrej@1552:                       <position x="266" y="240"/>
andrej@1552:                       <position x="232" y="240"/>
andrej@1552:                     </connection>
andrej@1552:                   </connectionPointIn>
andrej@1552:                 </variable>
andrej@1552:               </inputVariables>
andrej@1552:               <inOutVariables/>
andrej@1552:               <outputVariables>
andrej@1552:                 <variable formalParameter="OUT">
andrej@1552:                   <connectionPointOut>
andrej@1552:                     <relPosition x="57" y="30"/>
andrej@1552:                   </connectionPointOut>
andrej@1552:                 </variable>
andrej@1552:               </outputVariables>
andrej@1552:             </block>
andrej@1552:             <leftPowerRail localId="8" height="40" width="3">
andrej@1552:               <position x="46" y="42"/>
andrej@1552:               <connectionPointOut formalParameter="">
andrej@1552:                 <relPosition x="3" y="20"/>
andrej@1552:               </connectionPointOut>
andrej@1552:             </leftPowerRail>
andrej@1552:             <contact localId="9" height="15" width="21" negated="false">
andrej@1552:               <position x="113" y="54"/>
andrej@1552:               <connectionPointIn>
andrej@1552:                 <relPosition x="0" y="8"/>
andrej@1552:                 <connection refLocalId="8">
andrej@1552:                   <position x="113" y="62"/>
andrej@1552:                   <position x="49" y="62"/>
andrej@1552:                 </connection>
andrej@1552:               </connectionPointIn>
andrej@1552:               <connectionPointOut>
andrej@1552:                 <relPosition x="21" y="8"/>
andrej@1552:               </connectionPointOut>
andrej@1552:               <variable>Reset</variable>
andrej@1552:             </contact>
andrej@1552:           </LD>
andrej@1552:         </body>
andrej@1552:       </pou>
andrej@1552:     </pous>
andrej@1552:   </types>
andrej@1552:   <instances>
andrej@1552:     <configurations>
andrej@1552:       <configuration name="config">
andrej@1552:         <resource name="resource1">
andrej@1552:           <task name="plc_task" priority="1" interval="T#100ms">
andrej@1552:             <pouInstance name="plc_task_instance" typeName="plc_prg"/>
andrej@1552:           </task>
andrej@1552:         </resource>
andrej@1552:         <globalVars constant="true">
andrej@1552:           <variable name="ResetCounterValue">
andrej@1552:             <type>
andrej@1552:               <INT/>
andrej@1552:             </type>
andrej@1552:             <initialValue>
andrej@1552:               <simpleValue value="17"/>
andrej@1552:             </initialValue>
andrej@1552:           </variable>
andrej@1552:         </globalVars>
andrej@1552:       </configuration>
andrej@1552:     </configurations>
andrej@1552:   </instances>
andrej@1552: </project>