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