cleanup python example
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Wed, 12 Oct 2016 17:53:18 +0300
changeset 1541 9be98ccfed97
parent 1540 cf1df00e6f86
child 1542 0535a6b50534
cleanup python example
tests/python/plc.xml
--- a/tests/python/plc.xml	Thu Oct 06 11:30:04 2016 +0300
+++ b/tests/python/plc.xml	Wed Oct 12 17:53:18 2016 +0300
@@ -1,7 +1,7 @@
 <?xml version='1.0' encoding='utf-8'?>
 <project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
-  <fileHeader companyName="" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:21:19"/>
-  <contentHeader name="Beremiz Python Support Tests" modificationDateTime="2015-03-13T22:06:10">
+  <fileHeader companyName="" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:21:19" contentDescription="This example shows many features in Beremiz:&#10;&#10;   1. How to implement python extensions.&#10;   2. How to implement basic C extension.&#10;   3. How to use C code in IEC POUs.&#10;   4. How to call C functions from python code.&#10;   5. How to avoid race conditions between IEC, C and python code.&#10;   6. How to convert betweet different IEC types.&#10;"/>
+  <contentHeader name="Beremiz Python Support Tests" modificationDateTime="2016-10-12T14:15:35">
     <coordinateInfo>
       <pageSize x="1024" y="1024"/>
       <fbd>
@@ -54,6 +54,22 @@
       <pou name="main_pytest" pouType="program">
         <interface>
           <localVars>
+            <variable name="mux1_sel">
+              <type>
+                <INT/>
+              </type>
+              <initialValue>
+                <simpleValue value="3"/>
+              </initialValue>
+            </variable>
+            <variable name="mux2_sel">
+              <type>
+                <INT/>
+              </type>
+              <initialValue>
+                <simpleValue value="3"/>
+              </initialValue>
+            </variable>
             <variable name="pytest_var1">
               <type>
                 <string/>
@@ -128,17 +144,30 @@
                 <WORD/>
               </type>
               <initialValue>
-                <simpleValue value="300"/>
+                <simpleValue value="151"/>
               </initialValue>
             </variable>
+            <variable name="Test_BCD_WRONG">
+              <type>
+                <WORD/>
+              </type>
+              <initialValue>
+                <simpleValue value="154"/>
+              </initialValue>
+            </variable>
+            <variable name="Test_BCD_CONVERTED">
+              <type>
+                <BOOL/>
+              </type>
+            </variable>
             <variable name="Test_BCD_RESULT">
               <type>
                 <UINT/>
               </type>
             </variable>
-            <variable name="Test_BCD_ENO">
-              <type>
-                <BOOL/>
+            <variable name="Test_BCD_WRONG_RESULT">
+              <type>
+                <UINT/>
               </type>
             </variable>
             <variable name="Test_DT">
@@ -208,24 +237,24 @@
         </interface>
         <body>
           <FBD>
-            <inVariable localId="4" height="30" width="160">
-              <position x="295" y="230"/>
+            <inVariable localId="4" height="30" width="160" executionOrderId="0" negated="false">
+              <position x="295" y="450"/>
               <connectionPointOut>
                 <relPosition x="160" y="15"/>
               </connectionPointOut>
               <expression>'time.sleep(1)'</expression>
             </inVariable>
-            <block localId="5" width="125" height="80" typeName="python_eval" instanceName="py1">
-              <position x="650" y="180"/>
+            <block localId="5" width="125" height="80" typeName="python_eval" instanceName="py1" executionOrderId="0">
+              <position x="650" y="400"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
                   <connectionPointIn>
                     <relPosition x="0" y="35"/>
                     <connection refLocalId="7" formalParameter="OUT">
-                      <position x="650" y="215"/>
-                      <position x="285" y="215"/>
-                      <position x="285" y="260"/>
-                      <position x="250" y="260"/>
+                      <position x="650" y="435"/>
+                      <position x="285" y="435"/>
+                      <position x="285" y="480"/>
+                      <position x="250" y="480"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -233,8 +262,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="65"/>
                     <connection refLocalId="4">
-                      <position x="650" y="245"/>
-                      <position x="455" y="245"/>
+                      <position x="650" y="465"/>
+                      <position x="455" y="465"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -253,15 +282,15 @@
                 </variable>
               </outputVariables>
             </block>
-            <block localId="7" width="70" height="45" typeName="NOT">
-              <position x="180" y="230"/>
+            <block localId="7" width="70" height="45" typeName="NOT" executionOrderId="0">
+              <position x="180" y="450"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
                     <relPosition x="0" y="30"/>
                     <connection refLocalId="3">
-                      <position x="180" y="260"/>
-                      <position x="155" y="260"/>
+                      <position x="180" y="480"/>
+                      <position x="155" y="480"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -275,17 +304,17 @@
                 </variable>
               </outputVariables>
             </block>
-            <inOutVariable localId="3" height="30" width="120">
-              <position x="35" y="245"/>
+            <inOutVariable localId="3" height="30" width="120" executionOrderId="0" negatedOut="false" negatedIn="false">
+              <position x="35" y="465"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="7" formalParameter="OUT">
-                  <position x="35" y="260"/>
-                  <position x="25" y="260"/>
-                  <position x="25" y="220"/>
-                  <position x="270" y="220"/>
-                  <position x="270" y="260"/>
-                  <position x="250" y="260"/>
+                  <position x="35" y="480"/>
+                  <position x="25" y="480"/>
+                  <position x="25" y="440"/>
+                  <position x="270" y="440"/>
+                  <position x="270" y="480"/>
+                  <position x="250" y="480"/>
                 </connection>
               </connectionPointIn>
               <connectionPointOut>
@@ -293,17 +322,17 @@
               </connectionPointOut>
               <expression>pytest_var2</expression>
             </inOutVariable>
-            <block localId="8" width="125" height="80" typeName="python_eval" instanceName="Block1">
-              <position x="650" y="295"/>
+            <block localId="8" width="125" height="80" typeName="python_eval" instanceName="Block1" executionOrderId="0">
+              <position x="650" y="515"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
                   <connectionPointIn>
                     <relPosition x="0" y="35"/>
                     <connection refLocalId="7" formalParameter="OUT">
-                      <position x="650" y="330"/>
-                      <position x="285" y="330"/>
-                      <position x="285" y="260"/>
-                      <position x="250" y="260"/>
+                      <position x="650" y="550"/>
+                      <position x="285" y="550"/>
+                      <position x="285" y="480"/>
+                      <position x="250" y="480"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -311,8 +340,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="65"/>
                     <connection refLocalId="9">
-                      <position x="650" y="360"/>
-                      <position x="585" y="360"/>
+                      <position x="650" y="580"/>
+                      <position x="585" y="580"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -331,31 +360,31 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="9" height="30" width="290">
-              <position x="295" y="345"/>
+            <inVariable localId="9" height="30" width="290" executionOrderId="0" negated="false">
+              <position x="295" y="565"/>
               <connectionPointOut>
                 <relPosition x="290" y="15"/>
               </connectionPointOut>
               <expression>'sys.stdout.write("FBID :"+str(FBID)+"\n")'</expression>
             </inVariable>
-            <inVariable localId="11" height="30" width="290">
-              <position x="295" y="465"/>
+            <inVariable localId="11" height="30" width="290" executionOrderId="0" negated="false">
+              <position x="295" y="685"/>
               <connectionPointOut>
                 <relPosition x="290" y="15"/>
               </connectionPointOut>
               <expression>'PLCBinary.Simple_C_Call(5678)'</expression>
             </inVariable>
-            <block localId="12" width="125" height="80" typeName="python_eval" instanceName="Block2">
-              <position x="650" y="417"/>
+            <block localId="12" width="125" height="80" typeName="python_eval" instanceName="Block2" executionOrderId="0">
+              <position x="650" y="637"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
                   <connectionPointIn>
                     <relPosition x="0" y="33"/>
                     <connection refLocalId="7" formalParameter="OUT">
-                      <position x="650" y="450"/>
-                      <position x="285" y="450"/>
-                      <position x="285" y="260"/>
-                      <position x="250" y="260"/>
+                      <position x="650" y="670"/>
+                      <position x="285" y="670"/>
+                      <position x="285" y="480"/>
+                      <position x="250" y="480"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -363,8 +392,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="63"/>
                     <connection refLocalId="11">
-                      <position x="650" y="480"/>
-                      <position x="585" y="480"/>
+                      <position x="650" y="700"/>
+                      <position x="585" y="700"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -383,24 +412,24 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="14" height="30" width="290">
-              <position x="290" y="590"/>
+            <inVariable localId="14" height="30" width="290" executionOrderId="0" negated="false">
+              <position x="290" y="810"/>
               <connectionPointOut>
                 <relPosition x="290" y="15"/>
               </connectionPointOut>
               <expression>'MyPythonFunc(42)'</expression>
             </inVariable>
-            <block localId="15" width="125" height="80" typeName="python_eval" instanceName="Block3">
-              <position x="650" y="542"/>
+            <block localId="15" width="125" height="80" typeName="python_eval" instanceName="Block3" executionOrderId="0">
+              <position x="650" y="762"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
                   <connectionPointIn>
                     <relPosition x="0" y="33"/>
                     <connection refLocalId="7" formalParameter="OUT">
-                      <position x="650" y="575"/>
-                      <position x="285" y="575"/>
-                      <position x="285" y="260"/>
-                      <position x="250" y="260"/>
+                      <position x="650" y="795"/>
+                      <position x="285" y="795"/>
+                      <position x="285" y="480"/>
+                      <position x="250" y="480"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -408,8 +437,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="63"/>
                     <connection refLocalId="14">
-                      <position x="650" y="605"/>
-                      <position x="580" y="605"/>
+                      <position x="650" y="825"/>
+                      <position x="580" y="825"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -429,20 +458,22 @@
               </outputVariables>
             </block>
             <comment localId="16" height="90" width="680">
-              <position x="50" y="25"/>
+              <position x="35" y="275"/>
               <content>
-                <xhtml:p><![CDATA[This example test that, despite of 2T period clock stimulating TRIG pin of pyth_eval blocks, blocks keep executing one after the other, in respect of execution order.]]></xhtml:p>
+                <xhtml:p><![CDATA[This part of the example test that, despite of 2T period clock stimulating TRIG pin of pyth_eval blocks, blocks keep executing one after the other, in respect of execution order.]]></xhtml:p>
               </content>
             </comment>
-            <block localId="17" width="80" height="120" typeName="MUX">
-              <position x="1065" y="495"/>
+            <block localId="17" width="80" height="120" typeName="MUX" executionOrderId="0">
+              <position x="1065" y="715"/>
               <inputVariables>
                 <variable formalParameter="K">
                   <connectionPointIn>
                     <relPosition x="0" y="30"/>
                     <connection refLocalId="18">
-                      <position x="1065" y="525"/>
-                      <position x="1030" y="525"/>
+                      <position x="1065" y="745"/>
+                      <position x="1040" y="745"/>
+                      <position x="1040" y="735"/>
+                      <position x="1015" y="735"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -450,10 +481,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="50"/>
                     <connection refLocalId="5" formalParameter="RESULT">
-                      <position x="1065" y="545"/>
-                      <position x="905" y="545"/>
-                      <position x="905" y="245"/>
-                      <position x="775" y="245"/>
+                      <position x="1065" y="765"/>
+                      <position x="905" y="765"/>
+                      <position x="905" y="465"/>
+                      <position x="775" y="465"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -461,10 +492,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="70"/>
                     <connection refLocalId="8" formalParameter="RESULT">
-                      <position x="1065" y="565"/>
-                      <position x="890" y="565"/>
-                      <position x="890" y="360"/>
-                      <position x="775" y="360"/>
+                      <position x="1065" y="785"/>
+                      <position x="890" y="785"/>
+                      <position x="890" y="580"/>
+                      <position x="775" y="580"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -472,10 +503,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="90"/>
                     <connection refLocalId="12" formalParameter="RESULT">
-                      <position x="1065" y="585"/>
-                      <position x="875" y="585"/>
-                      <position x="875" y="480"/>
-                      <position x="775" y="480"/>
+                      <position x="1065" y="805"/>
+                      <position x="875" y="805"/>
+                      <position x="875" y="700"/>
+                      <position x="775" y="700"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -483,8 +514,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="110"/>
                     <connection refLocalId="15" formalParameter="RESULT">
-                      <position x="1065" y="605"/>
-                      <position x="775" y="605"/>
+                      <position x="1065" y="825"/>
+                      <position x="775" y="825"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -498,33 +529,28 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="18" height="30" width="20">
-              <position x="1010" y="510"/>
-              <connectionPointOut>
-                <relPosition x="20" y="15"/>
-              </connectionPointOut>
-              <expression>3</expression>
-            </inVariable>
-            <outVariable localId="19" height="35" width="125">
-              <position x="1185" y="510"/>
+            <outVariable localId="19" height="35" width="125" executionOrderId="0" negated="false">
+              <position x="1235" y="730"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="17" formalParameter="OUT">
-                  <position x="1185" y="525"/>
-                  <position x="1145" y="525"/>
+                  <position x="1235" y="745"/>
+                  <position x="1145" y="745"/>
                 </connection>
               </connectionPointIn>
               <expression>pytest_var1</expression>
             </outVariable>
-            <block localId="21" width="80" height="120" typeName="MUX">
-              <position x="985" y="165"/>
+            <block localId="21" width="80" height="120" typeName="MUX" executionOrderId="0">
+              <position x="1070" y="385"/>
               <inputVariables>
                 <variable formalParameter="K">
                   <connectionPointIn>
                     <relPosition x="0" y="30"/>
                     <connection refLocalId="22">
-                      <position x="985" y="195"/>
-                      <position x="950" y="195"/>
+                      <position x="1070" y="415"/>
+                      <position x="1040" y="415"/>
+                      <position x="1040" y="405"/>
+                      <position x="1010" y="405"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -532,8 +558,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="50"/>
                     <connection refLocalId="5" formalParameter="ACK">
-                      <position x="985" y="215"/>
-                      <position x="775" y="215"/>
+                      <position x="1070" y="435"/>
+                      <position x="775" y="435"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -541,10 +567,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="70"/>
                     <connection refLocalId="8" formalParameter="ACK">
-                      <position x="985" y="235"/>
-                      <position x="805" y="235"/>
-                      <position x="805" y="330"/>
-                      <position x="775" y="330"/>
+                      <position x="1070" y="455"/>
+                      <position x="805" y="455"/>
+                      <position x="805" y="550"/>
+                      <position x="775" y="550"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -552,10 +578,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="90"/>
                     <connection refLocalId="12" formalParameter="ACK">
-                      <position x="985" y="255"/>
-                      <position x="820" y="255"/>
-                      <position x="820" y="450"/>
-                      <position x="775" y="450"/>
+                      <position x="1070" y="475"/>
+                      <position x="820" y="475"/>
+                      <position x="820" y="670"/>
+                      <position x="775" y="670"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -563,10 +589,10 @@
                   <connectionPointIn>
                     <relPosition x="0" y="110"/>
                     <connection refLocalId="15" formalParameter="ACK">
-                      <position x="985" y="275"/>
-                      <position x="835" y="275"/>
-                      <position x="835" y="575"/>
-                      <position x="775" y="575"/>
+                      <position x="1070" y="495"/>
+                      <position x="835" y="495"/>
+                      <position x="835" y="795"/>
+                      <position x="775" y="795"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -580,51 +606,51 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="22" height="30" width="20">
-              <position x="930" y="180"/>
-              <connectionPointOut>
-                <relPosition x="20" y="15"/>
-              </connectionPointOut>
-              <expression>3</expression>
-            </inVariable>
-            <outVariable localId="23" height="35" width="125">
-              <position x="1150" y="180"/>
+            <inVariable localId="22" height="30" width="65" executionOrderId="0" negated="false">
+              <position x="945" y="390"/>
+              <connectionPointOut>
+                <relPosition x="65" y="15"/>
+              </connectionPointOut>
+              <expression>mux1_sel</expression>
+            </inVariable>
+            <outVariable localId="23" height="35" width="125" executionOrderId="0" negated="false">
+              <position x="1235" y="400"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="21" formalParameter="OUT">
-                  <position x="1150" y="195"/>
-                  <position x="1065" y="195"/>
+                  <position x="1235" y="415"/>
+                  <position x="1150" y="415"/>
                 </connection>
               </connectionPointIn>
               <expression>pytest_var3</expression>
             </outVariable>
-            <outVariable localId="25" height="30" width="60">
-              <position x="520" y="655"/>
+            <outVariable localId="25" height="30" width="60" executionOrderId="0" negated="false">
+              <position x="320" y="1075"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="26" formalParameter="OUT">
-                  <position x="520" y="670"/>
-                  <position x="465" y="670"/>
+                  <position x="320" y="1090"/>
+                  <position x="265" y="1090"/>
                 </connection>
               </connectionPointIn>
               <expression>FromC</expression>
             </outVariable>
-            <inVariable localId="1" height="30" width="30">
-              <position x="305" y="655"/>
+            <inVariable localId="1" height="30" width="30" executionOrderId="0" negated="false">
+              <position x="105" y="1075"/>
               <connectionPointOut>
                 <relPosition x="30" y="15"/>
               </connectionPointOut>
               <expression>23</expression>
             </inVariable>
-            <block localId="26" width="80" height="45" typeName="C_Pragma" instanceName="C_Pragma0">
-              <position x="385" y="640"/>
+            <block localId="26" width="80" height="45" typeName="C_Pragma" instanceName="C_Pragma0" executionOrderId="0">
+              <position x="185" y="1060"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
                     <relPosition x="0" y="30"/>
                     <connection refLocalId="1">
-                      <position x="385" y="670"/>
-                      <position x="335" y="670"/>
+                      <position x="185" y="1090"/>
+                      <position x="135" y="1090"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -638,139 +664,129 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="27" height="30" width="90">
-              <position x="300" y="770"/>
+            <inVariable localId="27" height="30" width="90" executionOrderId="0" negated="false">
+              <position x="100" y="1190"/>
               <connectionPointOut>
                 <relPosition x="90" y="15"/>
               </connectionPointOut>
               <expression>TestInput</expression>
             </inVariable>
-            <outVariable localId="28" height="30" width="105">
-              <position x="395" y="705"/>
+            <outVariable localId="28" height="30" width="105" executionOrderId="0" negated="false">
+              <position x="195" y="1125"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="2">
-                  <position x="395" y="720"/>
-                  <position x="340" y="720"/>
+                  <position x="195" y="1140"/>
+                  <position x="140" y="1140"/>
                 </connection>
               </connectionPointIn>
               <expression>TestOutput</expression>
             </outVariable>
-            <outVariable localId="29" height="30" width="85">
-              <position x="415" y="770"/>
+            <outVariable localId="29" height="30" width="85" executionOrderId="0" negated="false">
+              <position x="215" y="1190"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="27">
-                  <position x="415" y="785"/>
-                  <position x="390" y="785"/>
+                  <position x="215" y="1205"/>
+                  <position x="190" y="1205"/>
                 </connection>
               </connectionPointIn>
               <expression>FromInput</expression>
             </outVariable>
-            <inVariable localId="2" height="30" width="30">
-              <position x="310" y="705"/>
+            <inVariable localId="2" height="30" width="30" executionOrderId="0" negated="false">
+              <position x="110" y="1125"/>
               <connectionPointOut>
                 <relPosition x="30" y="15"/>
               </connectionPointOut>
               <expression>10</expression>
             </inVariable>
-            <comment localId="30" height="90" width="405">
-              <position x="245" y="825"/>
+            <comment localId="30" height="75" width="465">
+              <position x="50" y="945"/>
               <content>
                 <xhtml:p><![CDATA[You will be ready to use beremiz with C and Python when you will understand why "FromInput" is equal  to 75.
-Enjoy. ]]></xhtml:p>
+Happy hacking! ]]></xhtml:p>
               </content>
             </comment>
             <comment localId="31" height="60" width="345">
-              <position x="295" y="265"/>
+              <position x="295" y="485"/>
               <content>
                 <xhtml:p><![CDATA[Sleep here is bad. It blocks other py_eval instances. Whith a wxGlade GUI, GUI freeze for a second.]]></xhtml:p>
               </content>
             </comment>
             <comment localId="6" height="60" width="345">
-              <position x="295" y="380"/>
+              <position x="295" y="600"/>
               <content>
                 <xhtml:p><![CDATA[Prints FBID to stdout of PLC runtime. FBID is a unique reference to py_eval instance.]]></xhtml:p>
               </content>
             </comment>
             <comment localId="10" height="60" width="345">
-              <position x="295" y="500"/>
+              <position x="295" y="720"/>
               <content>
                 <xhtml:p><![CDATA[Simple_C_Call is declared in C_File "1.x:c_code". See python ctypes manual for details on typing.]]></xhtml:p>
               </content>
             </comment>
             <comment localId="32" height="105" width="235">
-              <position x="25" y="285"/>
+              <position x="25" y="505"/>
               <content>
                 <xhtml:p><![CDATA[Fast clock, at least faster that sleep(1). See what happens when python takes time to answer : PLC continues.]]></xhtml:p>
               </content>
             </comment>
-            <outVariable localId="33" height="30" width="130">
-              <position x="1060" y="740"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+            <outVariable localId="33" height="30" width="130" executionOrderId="0" negated="false">
+              <position x="580" y="1564"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="35" formalParameter="OUT">
-                  <position x="1060" y="755"/>
-                  <position x="1005" y="755"/>
+                  <position x="580" y="1580"/>
+                  <position x="370" y="1580"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_BCD_RESULT</expression>
             </outVariable>
-            <inVariable localId="34" height="30" width="75">
-              <position x="785" y="740"/>
-              <connectionPointOut>
-                <relPosition x="75" y="15"/>
+            <inVariable localId="34" height="30" width="75" executionOrderId="0" negated="false">
+              <position x="60" y="1564"/>
+              <connectionPointOut>
+                <relPosition x="75" y="16"/>
               </connectionPointOut>
               <expression>Test_BCD</expression>
             </inVariable>
-            <block localId="35" width="105" height="60" typeName="BCD_TO_UINT">
-              <position x="900" y="705"/>
-              <inputVariables>
-                <variable formalParameter="EN">
-                  <connectionPointIn>
-                    <relPosition x="0" y="30"/>
-                  </connectionPointIn>
-                </variable>
+            <block localId="35" width="105" height="60" typeName="BCD_TO_UINT" executionOrderId="0">
+              <position x="265" y="1539"/>
+              <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="50"/>
+                    <relPosition x="0" y="41"/>
                     <connection refLocalId="34">
-                      <position x="900" y="755"/>
-                      <position x="860" y="755"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-              </inputVariables>
-              <inOutVariables/>
-              <outputVariables>
-                <variable formalParameter="ENO">
-                  <connectionPointOut>
-                    <relPosition x="105" y="30"/>
-                  </connectionPointOut>
-                </variable>
+                      <position x="265" y="1580"/>
+                      <position x="135" y="1580"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="105" y="50"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <inVariable localId="36" height="30" width="65">
-              <position x="790" y="815"/>
-              <connectionPointOut>
-                <relPosition x="65" y="15"/>
+                    <relPosition x="105" y="41"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="36" height="30" width="65" executionOrderId="0" negated="false">
+              <position x="60" y="1774"/>
+              <connectionPointOut>
+                <relPosition x="65" y="16"/>
               </connectionPointOut>
               <expression>Test_DT</expression>
             </inVariable>
-            <block localId="37" width="255" height="45" typeName="DATE_AND_TIME_TO_TIME_OF_DAY">
-              <position x="900" y="800"/>
+            <block localId="37" width="255" height="45" typeName="DATE_AND_TIME_TO_TIME_OF_DAY" executionOrderId="0">
+              <position x="265" y="1759"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="31"/>
                     <connection refLocalId="36">
-                      <position x="900" y="830"/>
-                      <position x="855" y="830"/>
+                      <position x="265" y="1790"/>
+                      <position x="125" y="1790"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -779,22 +795,22 @@
               <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="255" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <block localId="38" width="195" height="45" typeName="DATE_AND_TIME_TO_DATE">
-              <position x="900" y="875"/>
+                    <relPosition x="255" y="31"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <block localId="38" width="195" height="45" typeName="DATE_AND_TIME_TO_DATE" executionOrderId="0">
+              <position x="265" y="1834"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="31"/>
                     <connection refLocalId="36">
-                      <position x="900" y="905"/>
-                      <position x="877" y="905"/>
-                      <position x="877" y="830"/>
-                      <position x="855" y="830"/>
+                      <position x="265" y="1865"/>
+                      <position x="242" y="1865"/>
+                      <position x="242" y="1790"/>
+                      <position x="125" y="1790"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -803,53 +819,53 @@
               <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="195" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <outVariable localId="40" height="30" width="80">
-              <position x="1215" y="890"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+                    <relPosition x="195" y="31"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="40" height="30" width="80" executionOrderId="0" negated="false">
+              <position x="580" y="1849"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="38" formalParameter="OUT">
-                  <position x="1215" y="905"/>
-                  <position x="1095" y="905"/>
+                  <position x="580" y="1865"/>
+                  <position x="460" y="1865"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_Date</expression>
             </outVariable>
-            <outVariable localId="42" height="30" width="90">
-              <position x="1100" y="985"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+            <outVariable localId="42" height="30" width="90" executionOrderId="0" negated="false">
+              <position x="465" y="1944"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="46" formalParameter="OUT">
-                  <position x="1100" y="1000"/>
-                  <position x="1030" y="1000"/>
+                  <position x="465" y="1960"/>
+                  <position x="395" y="1960"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_String</expression>
             </outVariable>
-            <outVariable localId="43" height="30" width="80">
-              <position x="1100" y="1055"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+            <outVariable localId="43" height="30" width="80" executionOrderId="0" negated="false">
+              <position x="465" y="2014"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="44" formalParameter="OUT">
-                  <position x="1100" y="1070"/>
-                  <position x="1035" y="1070"/>
+                  <position x="465" y="2030"/>
+                  <position x="400" y="2030"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_Bool</expression>
             </outVariable>
-            <block localId="44" width="135" height="45" typeName="STRING_TO_BOOL">
-              <position x="900" y="1040"/>
+            <block localId="44" width="135" height="45" typeName="STRING_TO_BOOL" executionOrderId="0">
+              <position x="265" y="1999"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="31"/>
                     <connection refLocalId="45">
-                      <position x="900" y="1070"/>
-                      <position x="850" y="1070"/>
+                      <position x="265" y="2030"/>
+                      <position x="115" y="2030"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -858,27 +874,27 @@
               <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="135" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <inVariable localId="45" height="30" width="55">
-              <position x="795" y="1055"/>
-              <connectionPointOut>
-                <relPosition x="55" y="15"/>
+                    <relPosition x="135" y="31"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inVariable localId="45" height="30" width="55" executionOrderId="0" negated="false">
+              <position x="60" y="2014"/>
+              <connectionPointOut>
+                <relPosition x="55" y="16"/>
               </connectionPointOut>
               <expression>'True'</expression>
             </inVariable>
-            <block localId="46" width="130" height="45" typeName="INT_TO_STRING">
-              <position x="900" y="970"/>
+            <block localId="46" width="130" height="45" typeName="INT_TO_STRING" executionOrderId="0">
+              <position x="265" y="1929"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="31"/>
                     <connection refLocalId="58">
-                      <position x="900" y="1000"/>
-                      <position x="840" y="1000"/>
+                      <position x="265" y="1960"/>
+                      <position x="205" y="1960"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -887,27 +903,27 @@
               <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="130" y="30"/>
+                    <relPosition x="130" y="31"/>
                   </connectionPointOut>
                 </variable>
               </outputVariables>
             </block>
             <inVariable localId="50" height="30" width="105" executionOrderId="0" negated="false">
-              <position x="200" y="1085"/>
+              <position x="75" y="2275"/>
               <connectionPointOut>
                 <relPosition x="105" y="15"/>
               </connectionPointOut>
               <expression>Global_RS.Q1</expression>
             </inVariable>
             <block localId="51" width="70" height="85" typeName="AND" executionOrderId="0">
-              <position x="365" y="1065"/>
+              <position x="240" y="2255"/>
               <inputVariables>
                 <variable formalParameter="IN1" negated="true">
                   <connectionPointIn>
                     <relPosition x="0" y="35"/>
                     <connection refLocalId="50">
-                      <position x="365" y="1100"/>
-                      <position x="305" y="1100"/>
+                      <position x="240" y="2290"/>
+                      <position x="180" y="2290"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -915,8 +931,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="70"/>
                     <connection refLocalId="52">
-                      <position x="365" y="1135"/>
-                      <position x="305" y="1135"/>
+                      <position x="240" y="2325"/>
+                      <position x="180" y="2325"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -930,51 +946,51 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="52" height="30" width="95">
-              <position x="210" y="1120"/>
-              <connectionPointOut>
-                <relPosition x="95" y="15"/>
+            <inVariable localId="52" height="30" width="105" executionOrderId="0" negated="false">
+              <position x="75" y="2310"/>
+              <connectionPointOut>
+                <relPosition x="105" y="15"/>
               </connectionPointOut>
               <expression>BOOL#TRUE</expression>
             </inVariable>
             <outVariable localId="13" height="30" width="105" executionOrderId="0" negated="false">
-              <position x="510" y="1085"/>
+              <position x="385" y="2275"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="51" formalParameter="OUT">
-                  <position x="510" y="1100"/>
-                  <position x="435" y="1100"/>
+                  <position x="385" y="2290"/>
+                  <position x="310" y="2290"/>
                 </connection>
               </connectionPointIn>
               <expression>Global_RS.S</expression>
             </outVariable>
             <outVariable localId="20" height="30" width="105" executionOrderId="0" negated="false">
-              <position x="510" y="1200"/>
+              <position x="385" y="2390"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="41" formalParameter="OUT">
-                  <position x="510" y="1215"/>
-                  <position x="435" y="1215"/>
+                  <position x="385" y="2405"/>
+                  <position x="310" y="2405"/>
                 </connection>
               </connectionPointIn>
               <expression>Global_RS.R1</expression>
             </outVariable>
             <inVariable localId="24" height="30" width="105" executionOrderId="0" negated="false">
-              <position x="200" y="1200"/>
+              <position x="75" y="2390"/>
               <connectionPointOut>
                 <relPosition x="105" y="15"/>
               </connectionPointOut>
               <expression>Global_RS.Q1</expression>
             </inVariable>
             <block localId="41" width="70" height="85" typeName="OR" executionOrderId="0">
-              <position x="365" y="1180"/>
+              <position x="240" y="2370"/>
               <inputVariables>
                 <variable formalParameter="IN1">
                   <connectionPointIn>
                     <relPosition x="0" y="35"/>
                     <connection refLocalId="24">
-                      <position x="365" y="1215"/>
-                      <position x="305" y="1215"/>
+                      <position x="240" y="2405"/>
+                      <position x="180" y="2405"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -982,8 +998,8 @@
                   <connectionPointIn>
                     <relPosition x="0" y="70"/>
                     <connection refLocalId="48">
-                      <position x="365" y="1250"/>
-                      <position x="305" y="1250"/>
+                      <position x="240" y="2440"/>
+                      <position x="180" y="2440"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -997,46 +1013,33 @@
                 </variable>
               </outputVariables>
             </block>
-            <inVariable localId="48" height="30" width="100">
-              <position x="205" y="1235"/>
-              <connectionPointOut>
-                <relPosition x="100" y="15"/>
+            <inVariable localId="48" height="30" width="105" executionOrderId="0" negated="false">
+              <position x="75" y="2425"/>
+              <connectionPointOut>
+                <relPosition x="105" y="15"/>
               </connectionPointOut>
               <expression>BOOL#FALSE</expression>
             </inVariable>
-            <outVariable localId="53" height="30" width="115">
-              <position x="1060" y="700"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
-                <connection refLocalId="35" formalParameter="ENO">
-                  <position x="1060" y="715"/>
-                  <position x="1032" y="715"/>
-                  <position x="1032" y="735"/>
-                  <position x="1005" y="735"/>
-                </connection>
-              </connectionPointIn>
-              <expression>Test_BCD_ENO</expression>
-            </outVariable>
-            <outVariable localId="54" height="30" width="135">
-              <position x="1565" y="815"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+            <outVariable localId="54" height="30" width="135" executionOrderId="0" negated="false">
+              <position x="930" y="1774"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="55" formalParameter="OUT">
-                  <position x="1565" y="830"/>
-                  <position x="1490" y="830"/>
+                  <position x="930" y="1790"/>
+                  <position x="855" y="1790"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_TOD_STRING</expression>
             </outVariable>
-            <block localId="55" width="125" height="45" typeName="TOD_TO_STRING">
-              <position x="1365" y="800"/>
+            <block localId="55" width="125" height="45" typeName="TOD_TO_STRING" executionOrderId="0">
+              <position x="730" y="1759"/>
               <inputVariables>
                 <variable formalParameter="IN">
                   <connectionPointIn>
-                    <relPosition x="0" y="30"/>
+                    <relPosition x="0" y="31"/>
                     <connection refLocalId="39">
-                      <position x="1365" y="830"/>
-                      <position x="1290" y="830"/>
+                      <position x="730" y="1790"/>
+                      <position x="655" y="1790"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -1045,90 +1048,90 @@
               <outputVariables>
                 <variable formalParameter="OUT">
                   <connectionPointOut>
-                    <relPosition x="125" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <inOutVariable localId="39" height="30" width="75">
-              <position x="1215" y="815"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
+                    <relPosition x="125" y="31"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <inOutVariable localId="39" height="30" width="75" executionOrderId="0" negatedOut="false" negatedIn="false">
+              <position x="580" y="1774"/>
+              <connectionPointIn>
+                <relPosition x="0" y="16"/>
                 <connection refLocalId="37" formalParameter="OUT">
-                  <position x="1215" y="830"/>
-                  <position x="1155" y="830"/>
-                </connection>
-              </connectionPointIn>
-              <connectionPointOut>
-                <relPosition x="75" y="15"/>
+                  <position x="580" y="1790"/>
+                  <position x="520" y="1790"/>
+                </connection>
+              </connectionPointIn>
+              <connectionPointOut>
+                <relPosition x="75" y="16"/>
               </connectionPointOut>
               <expression>Test_TOD</expression>
             </inOutVariable>
-            <inVariable localId="49" height="30" width="30">
-              <position x="765" y="1200"/>
+            <inVariable localId="49" height="30" width="30" executionOrderId="0" negated="false">
+              <position x="160" y="2510"/>
               <connectionPointOut>
                 <relPosition x="30" y="15"/>
               </connectionPointOut>
               <expression>42</expression>
             </inVariable>
-            <outVariable localId="57" height="30" width="50">
-              <position x="845" y="1200"/>
+            <outVariable localId="57" height="30" width="50" executionOrderId="0" negated="false">
+              <position x="240" y="2510"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="49">
-                  <position x="845" y="1215"/>
-                  <position x="795" y="1215"/>
+                  <position x="240" y="2525"/>
+                  <position x="190" y="2525"/>
                 </connection>
               </connectionPointIn>
               <expression>TOTO</expression>
             </outVariable>
-            <outVariable localId="56" height="30" width="50">
-              <position x="845" y="1240"/>
+            <outVariable localId="56" height="30" width="50" executionOrderId="0" negated="false">
+              <position x="240" y="2550"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="49">
-                  <position x="845" y="1255"/>
-                  <position x="820" y="1255"/>
-                  <position x="820" y="1215"/>
-                  <position x="795" y="1215"/>
+                  <position x="240" y="2565"/>
+                  <position x="215" y="2565"/>
+                  <position x="215" y="2525"/>
+                  <position x="190" y="2525"/>
                 </connection>
               </connectionPointIn>
               <expression>TUTU</expression>
             </outVariable>
-            <inVariable localId="58" height="30" width="145">
-              <position x="715" y="985"/>
-              <connectionPointOut>
-                <relPosition x="145" y="15"/>
+            <inVariable localId="58" height="30" width="145" executionOrderId="0" negated="false">
+              <position x="60" y="1944"/>
+              <connectionPointOut>
+                <relPosition x="145" y="16"/>
               </connectionPointOut>
               <expression>Second_Python_Var</expression>
             </inVariable>
-            <outVariable localId="47" height="30" width="125">
-              <position x="400" y="975"/>
+            <outVariable localId="47" height="30" width="125" executionOrderId="0" negated="false">
+              <position x="200" y="1385"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="59">
-                  <position x="400" y="990"/>
-                  <position x="330" y="990"/>
+                  <position x="200" y="1400"/>
+                  <position x="130" y="1400"/>
                 </connection>
               </connectionPointIn>
               <expression>Test_Python_Var</expression>
             </outVariable>
-            <inVariable localId="59" height="30" width="30">
-              <position x="300" y="975"/>
+            <inVariable localId="59" height="30" width="30" executionOrderId="0" negated="false">
+              <position x="100" y="1385"/>
               <connectionPointOut>
                 <relPosition x="30" y="15"/>
               </connectionPointOut>
               <expression>23</expression>
             </inVariable>
             <block localId="61" typeName="function0" executionOrderId="0" height="45" width="110">
-              <position x="1680" y="255"/>
+              <position x="760" y="1170"/>
               <inputVariables>
                 <variable formalParameter="LocalVar0">
                   <connectionPointIn>
                     <relPosition x="0" y="30"/>
                     <connection refLocalId="62">
-                      <position x="1680" y="285"/>
-                      <position x="1640" y="285"/>
+                      <position x="760" y="1200"/>
+                      <position x="720" y="1200"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -1143,23 +1146,147 @@
               </outputVariables>
             </block>
             <inVariable localId="62" executionOrderId="0" height="30" width="55" negated="false">
-              <position x="1585" y="270"/>
+              <position x="665" y="1185"/>
               <connectionPointOut>
                 <relPosition x="55" y="15"/>
               </connectionPointOut>
               <expression>fefvsd</expression>
             </inVariable>
             <outVariable localId="63" executionOrderId="0" height="30" width="55" negated="false">
-              <position x="1825" y="270"/>
+              <position x="905" y="1185"/>
               <connectionPointIn>
                 <relPosition x="0" y="15"/>
                 <connection refLocalId="61" formalParameter="OUT">
-                  <position x="1825" y="285"/>
-                  <position x="1790" y="285"/>
+                  <position x="905" y="1200"/>
+                  <position x="870" y="1200"/>
                 </connection>
               </connectionPointIn>
               <expression>fefvsd</expression>
             </outVariable>
+            <comment localId="53" height="65" width="420">
+              <position x="75" y="2160"/>
+              <content>
+                <xhtml:p><![CDATA[Shows global variables access from resource configuration (res_pytest) and from project's configuration.]]></xhtml:p>
+              </content>
+            </comment>
+            <inVariable localId="18" height="30" width="65" executionOrderId="0" negated="false">
+              <position x="950" y="720"/>
+              <connectionPointOut>
+                <relPosition x="65" y="15"/>
+              </connectionPointOut>
+              <expression>mux2_sel</expression>
+            </inVariable>
+            <comment localId="60" height="45" width="930">
+              <position x="60" y="1480"/>
+              <content>
+                <xhtml:p><![CDATA[Here is shown how to convert values between different types (BCD, DT, TOD, STRING and others) using standard functions.]]></xhtml:p>
+              </content>
+            </comment>
+            <comment localId="64" height="55" width="300">
+              <position x="665" y="1095"/>
+              <content>
+                <xhtml:p><![CDATA[Example of usage of user-defined function.]]></xhtml:p>
+              </content>
+            </comment>
+            <comment localId="65" height="45" width="410">
+              <position x="55" y="1315"/>
+              <content>
+                <xhtml:p><![CDATA[Shows access variable defined in python extension. ]]></xhtml:p>
+              </content>
+            </comment>
+            <inVariable localId="66" height="30" width="130" executionOrderId="0" negated="false">
+              <position x="60" y="1685"/>
+              <connectionPointOut>
+                <relPosition x="130" y="15"/>
+              </connectionPointOut>
+              <expression>Test_BCD_WRONG</expression>
+            </inVariable>
+            <block localId="67" width="105" height="100" typeName="BCD_TO_UINT" executionOrderId="0">
+              <position x="265" y="1620"/>
+              <inputVariables>
+                <variable formalParameter="EN">
+                  <connectionPointIn>
+                    <relPosition x="0" y="40"/>
+                  </connectionPointIn>
+                </variable>
+                <variable formalParameter="IN">
+                  <connectionPointIn>
+                    <relPosition x="0" y="80"/>
+                    <connection refLocalId="66">
+                      <position x="265" y="1700"/>
+                      <position x="255" y="1700"/>
+                      <position x="255" y="1700"/>
+                      <position x="345" y="1700"/>
+                      <position x="345" y="1700"/>
+                      <position x="190" y="1700"/>
+                    </connection>
+                  </connectionPointIn>
+                </variable>
+              </inputVariables>
+              <inOutVariables/>
+              <outputVariables>
+                <variable formalParameter="ENO">
+                  <connectionPointOut>
+                    <relPosition x="105" y="40"/>
+                  </connectionPointOut>
+                </variable>
+                <variable formalParameter="OUT">
+                  <connectionPointOut>
+                    <relPosition x="105" y="80"/>
+                  </connectionPointOut>
+                </variable>
+              </outputVariables>
+            </block>
+            <outVariable localId="68" height="30" width="185" executionOrderId="0" negated="false">
+              <position x="580" y="1685"/>
+              <connectionPointIn>
+                <relPosition x="0" y="15"/>
+                <connection refLocalId="67" formalParameter="OUT">
+                  <position x="580" y="1700"/>
+                  <position x="370" y="1700"/>
+                </connection>
+              </connectionPointIn>
+              <expression>Test_BCD_WRONG_RESULT</expression>
+            </outVariable>
+            <comment localId="69" height="135" width="375">
+              <position x="795" y="1590"/>
+              <content>
+                <xhtml:p><![CDATA[Incorrect BCD number is not converted to UINT.
+
+151 (16#97) is good BCD number , but 
+154 (16#9A) is not.  
+
+Try this out and look at value of  Test_BCD_CONVERTED variable.
+
+
+]]></xhtml:p>
+              </content>
+            </comment>
+            <outVariable localId="70" height="30" width="185" executionOrderId="0" negated="false">
+              <position x="580" y="1645"/>
+              <connectionPointIn>
+                <relPosition x="0" y="15"/>
+                <connection refLocalId="67" formalParameter="ENO">
+                  <position x="580" y="1660"/>
+                  <position x="370" y="1660"/>
+                </connection>
+              </connectionPointIn>
+              <expression>Test_BCD_CONVERTED</expression>
+            </outVariable>
+            <comment localId="71" height="170" width="680">
+              <position x="35" y="30"/>
+              <content>
+                <xhtml:p><![CDATA[This example shows many features in Beremiz:
+
+   1. How to implement python extensions.
+   2. How to implement basic C extension.
+   3. How to use C code in IEC POUs.
+   4. How to call C functions from python code.
+   5. How to avoid race conditions between IEC, C and python code.
+   6. How to convert betweet different IEC types.
+]]></xhtml:p>
+              </content>
+            </comment>
           </FBD>
         </body>
       </pou>
@@ -1243,7 +1370,7 @@
     SetFbVar(COORDS, somebyte, .table[4]);
   }
 }}
-(* If you do not use __GET_VAR and _SET_VAR macro, expect unexpected *)
+(* If you do not use GetFbVar and SetFbVar macros, expect unexpected behaviour*)
 Global_RS();
 ]]></xhtml:p>
           </ST>