etherlab/pous.xml
changeset 2086 8e4992e0f147
child 2090 52b398c75ba9
equal deleted inserted replaced
2085:ae263886ae92 2086:8e4992e0f147
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <project xmlns="http://www.plcopen.org/xml/tc6.xsd"
       
     3          xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd"
       
     4          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       
     5          xmlns:xhtml="http://www.w3.org/1999/xhtml">
       
     6   <fileHeader companyName="EtherlabMaster"
       
     7               productName="EtherlabMaster"
       
     8               productVersion="1"
       
     9               creationDateTime="2012-10-22T12:12:45"/>
       
    10   <contentHeader name="EtherlabMaster SDO Blocks"
       
    11                  modificationDateTime="2012-10-25T19:53:33">
       
    12     <coordinateInfo>
       
    13       <fbd>
       
    14         <scaling x="0" y="0"/>
       
    15       </fbd>
       
    16       <ld>
       
    17         <scaling x="0" y="0"/>
       
    18       </ld>
       
    19       <sfc>
       
    20         <scaling x="0" y="0"/>
       
    21       </sfc>
       
    22     </coordinateInfo>
       
    23   </contentHeader>
       
    24   <types>
       
    25     <dataTypes/>
       
    26     <pous>
       
    27       <pou name="EtherLabSDOUpload" pouType="functionBlock">
       
    28         <interface>
       
    29           <inputVars>
       
    30             <variable name="EXECUTE">
       
    31               <type>
       
    32                 <BOOL/>
       
    33               </type>
       
    34             </variable>
       
    35             <variable name="POS">
       
    36               <type>
       
    37                 <INT/>
       
    38               </type>
       
    39             </variable>
       
    40             <variable name="INDEX">
       
    41               <type>
       
    42                 <UINT/>
       
    43               </type>
       
    44             </variable>
       
    45             <variable name="SUBINDEX">
       
    46               <type>
       
    47                 <USINT/>
       
    48               </type>
       
    49             </variable>
       
    50             <variable name="VARTYPE">
       
    51               <type>
       
    52                 <string/>
       
    53               </type>
       
    54             </variable>
       
    55           </inputVars>
       
    56           <outputVars>
       
    57             <variable name="ACK">
       
    58               <type>
       
    59                 <BOOL/>
       
    60               </type>
       
    61             </variable>
       
    62             <variable name="VALID">
       
    63               <type>
       
    64                 <BOOL/>
       
    65               </type>
       
    66             </variable>
       
    67             <variable name="VALUE">
       
    68               <type>
       
    69                 <string/>
       
    70               </type>
       
    71             </variable>
       
    72           </outputVars>
       
    73           <localVars>
       
    74             <variable name="PY0">
       
    75               <type>
       
    76                 <derived name="python_eval"/>
       
    77               </type>
       
    78             </variable>
       
    79             <variable name="PY1">
       
    80               <type>
       
    81                 <derived name="python_eval"/>
       
    82               </type>
       
    83             </variable>
       
    84             <variable name="EXECUTE0">
       
    85               <type>
       
    86                 <BOOL/>
       
    87               </type>
       
    88             </variable>
       
    89             <variable name="STATE">
       
    90               <type>
       
    91                 <INT/>
       
    92               </type>
       
    93               <initialValue>
       
    94                 <simpleValue value="0"/>
       
    95               </initialValue>
       
    96             </variable>
       
    97           </localVars>
       
    98         </interface>
       
    99         <body>
       
   100           <ST>
       
   101 <![CDATA[{extern int AcquireSDOLock();}
       
   102 {extern int HasAnswer();}
       
   103 {extern void ReleaseSDOLock();}
       
   104 CASE STATE OF
       
   105   0:
       
   106     IF EXECUTE AND NOT EXECUTE0 THEN
       
   107       STATE := 1;
       
   108       ACK := 0;
       
   109       VALID := 0;
       
   110       VALUE := 'None';
       
   111     END_IF;
       
   112   1:
       
   113     {if (AcquireSDOLock()) __SET_VAR(data__->,STATE, 2)}
       
   114   2:
       
   115     IF PY0.ACK THEN
       
   116       STATE := 3;
       
   117     END_IF;
       
   118   3:
       
   119     {if (HasAnswer()) __SET_VAR(data__->,STATE, 4)}
       
   120   4:
       
   121     IF PY1.ACK THEN
       
   122       ACK := 1;
       
   123       VALUE := PY1.RESULT;
       
   124       VALID := NE(VALUE, 'None');
       
   125       STATE := 0;
       
   126       {ReleaseSDOLock();}
       
   127     END_IF;
       
   128 ELSE
       
   129   STATE := 0;
       
   130 END_CASE;
       
   131 
       
   132 EXECUTE0 := EXECUTE;
       
   133 PY0(TRIG := STATE = 2, 
       
   134     CODE := CONCAT('EthercatSDOUpload(',
       
   135                    INT_TO_STRING(POS),
       
   136                    ',',
       
   137                    UINT_TO_STRING(INDEX),
       
   138                    ',',
       
   139                    USINT_TO_STRING(SUBINDEX),
       
   140                    ',"',
       
   141                    VARTYPE,
       
   142                    '")'));
       
   143 PY1(TRIG := STATE = 4, 
       
   144     CODE := 'GetResult()');
       
   145 ]]>
       
   146           </ST>
       
   147         </body>
       
   148       </pou>
       
   149       <pou name="EtherLabSDODownload" pouType="functionBlock">
       
   150         <interface>
       
   151           <inputVars>
       
   152             <variable name="EXECUTE">
       
   153               <type>
       
   154                 <BOOL/>
       
   155               </type>
       
   156             </variable>
       
   157             <variable name="POS">
       
   158               <type>
       
   159                 <INT/>
       
   160               </type>
       
   161             </variable>
       
   162             <variable name="INDEX">
       
   163               <type>
       
   164                 <UINT/>
       
   165               </type>
       
   166             </variable>
       
   167             <variable name="SUBINDEX">
       
   168               <type>
       
   169                 <USINT/>
       
   170               </type>
       
   171             </variable>
       
   172             <variable name="VARTYPE">
       
   173               <type>
       
   174                 <string/>
       
   175               </type>
       
   176             </variable>
       
   177             <variable name="VALUE">
       
   178               <type>
       
   179                 <string/>
       
   180               </type>
       
   181             </variable>
       
   182           </inputVars>
       
   183           <outputVars>
       
   184             <variable name="ACK">
       
   185               <type>
       
   186                 <BOOL/>
       
   187               </type>
       
   188             </variable>
       
   189             <variable name="ERROR">
       
   190               <type>
       
   191                 <BOOL/>
       
   192               </type>
       
   193             </variable>
       
   194           </outputVars>
       
   195           <localVars>
       
   196             <variable name="PY0">
       
   197               <type>
       
   198                 <derived name="python_eval"/>
       
   199               </type>
       
   200             </variable>
       
   201             <variable name="PY1">
       
   202               <type>
       
   203                 <derived name="python_eval"/>
       
   204               </type>
       
   205             </variable>
       
   206             <variable name="EXECUTE0">
       
   207               <type>
       
   208                 <BOOL/>
       
   209               </type>
       
   210             </variable>
       
   211             <variable name="STATE">
       
   212               <type>
       
   213                 <INT/>
       
   214               </type>
       
   215               <initialValue>
       
   216                 <simpleValue value="0"/>
       
   217               </initialValue>
       
   218             </variable>
       
   219           </localVars>
       
   220         </interface>
       
   221         <body>
       
   222           <ST>
       
   223 <![CDATA[{extern int AcquireSDOLock();}
       
   224 {extern int HasAnswer();}
       
   225 {extern void ReleaseSDOLock();}
       
   226 CASE STATE OF
       
   227   0:
       
   228     IF EXECUTE AND NOT EXECUTE0 THEN
       
   229       STATE := 1;
       
   230       ACK := 0;
       
   231       ERROR := 0;
       
   232     END_IF;
       
   233   1:
       
   234     {if (AcquireSDOLock()) __SET_VAR(data__->,STATE, 2)}
       
   235   2:
       
   236     IF PY0.ACK THEN
       
   237       STATE := 3;
       
   238     END_IF;
       
   239   3:
       
   240     {if (HasAnswer()) __SET_VAR(data__->,STATE, 4)}
       
   241   4:
       
   242     IF PY1.ACK THEN
       
   243       ACK := 1;
       
   244       VALUE := PY1.RESULT;
       
   245       ERROR := EQ(PY1.RESULT, 'False');
       
   246       STATE := 0;
       
   247       {ReleaseSDOLock();}
       
   248     END_IF;
       
   249 ELSE
       
   250   STATE := 0;
       
   251 END_CASE;
       
   252 EXECUTE0 := EXECUTE;
       
   253 PY0(TRIG := STATE = 2, 
       
   254     CODE := CONCAT('EthercatSDODownload(',
       
   255                    INT_TO_STRING(POS),
       
   256                    ',',
       
   257                    UINT_TO_STRING(INDEX),
       
   258                    ',',
       
   259                    USINT_TO_STRING(SUBINDEX),
       
   260                    ',"',
       
   261                    VARTYPE,
       
   262                    '",',
       
   263                    VALUE,
       
   264                    ')'));
       
   265 PY1(TRIG := STATE = 4, 
       
   266     CODE := 'GetResult()');
       
   267 ]]>
       
   268           </ST>
       
   269         </body>
       
   270       </pou>
       
   271     </pous>
       
   272   </types>
       
   273   <instances>
       
   274     <configurations/>
       
   275   </instances>
       
   276 </project>