tests/python/plc.xml
changeset 861 980800a5aad0
parent 860 8a51046010d7
child 862 bb59865db6e6
equal deleted inserted replaced
860:8a51046010d7 861:980800a5aad0
     6   <fileHeader companyName="beremiz"
     6   <fileHeader companyName="beremiz"
     7               productName="Beremiz"
     7               productName="Beremiz"
     8               productVersion="0.0"
     8               productVersion="0.0"
     9               creationDateTime="2008-12-14T16:21:19"/>
     9               creationDateTime="2008-12-14T16:21:19"/>
    10   <contentHeader name="Beremiz Python Support Tests"
    10   <contentHeader name="Beremiz Python Support Tests"
    11                  modificationDateTime="2012-10-18T20:37:52">
    11                  modificationDateTime="2012-10-19T11:54:13">
    12     <coordinateInfo>
    12     <coordinateInfo>
    13       <pageSize x="1024" y="1024"/>
    13       <pageSize x="1024" y="1024"/>
    14       <fbd>
    14       <fbd>
    15         <scaling x="5" y="5"/>
    15         <scaling x="5" y="5"/>
    16       </fbd>
    16       </fbd>
    21         <scaling x="5" y="5"/>
    21         <scaling x="5" y="5"/>
    22       </sfc>
    22       </sfc>
    23     </coordinateInfo>
    23     </coordinateInfo>
    24   </contentHeader>
    24   </contentHeader>
    25   <types>
    25   <types>
    26     <dataTypes/>
    26     <dataTypes>
       
    27       <dataType name="CPLX_TYPE">
       
    28         <baseType>
       
    29           <struct>
       
    30             <variable name="FIRSTBYTE">
       
    31               <type>
       
    32                 <SINT/>
       
    33               </type>
       
    34             </variable>
       
    35             <variable name="SECONDBYTE">
       
    36               <type>
       
    37                 <SINT/>
       
    38               </type>
       
    39             </variable>
       
    40           </struct>
       
    41         </baseType>
       
    42       </dataType>
       
    43     </dataTypes>
    27     <pous>
    44     <pous>
    28       <pou name="main_pytest" pouType="program">
    45       <pou name="main_pytest" pouType="program">
    29         <interface>
    46         <interface>
    30           <localVars>
    47           <localVars>
    31             <variable name="pytest_var1">
    48             <variable name="pytest_var1">
   586               <type>
   603               <type>
   587                 <SINT/>
   604                 <SINT/>
   588               </type>
   605               </type>
   589             </variable>
   606             </variable>
   590           </inputVars>
   607           </inputVars>
       
   608           <localVars>
       
   609             <variable name="COORDS">
       
   610               <type>
       
   611                 <array>
       
   612                   <dimension lower="0" upper="5"/>
       
   613                   <baseType>
       
   614                     <SINT/>
       
   615                   </baseType>
       
   616                 </array>
       
   617               </type>
       
   618               <initialValue>
       
   619                 <arrayValue>
       
   620                   <value>
       
   621                     <simpleValue value="54"/>
       
   622                   </value>
       
   623                   <value>
       
   624                     <simpleValue value="55"/>
       
   625                   </value>
       
   626                   <value>
       
   627                     <simpleValue value="56"/>
       
   628                   </value>
       
   629                   <value>
       
   630                     <simpleValue value="57"/>
       
   631                   </value>
       
   632                   <value>
       
   633                     <simpleValue value="58"/>
       
   634                   </value>
       
   635                   <value>
       
   636                     <simpleValue value="59"/>
       
   637                   </value>
       
   638                 </arrayValue>
       
   639               </initialValue>
       
   640             </variable>
       
   641             <variable name="SMURF">
       
   642               <type>
       
   643                 <derived name="CPLX_TYPE"/>
       
   644               </type>
       
   645             </variable>
       
   646           </localVars>
   591         </interface>
   647         </interface>
   592         <body>
   648         <body>
   593           <ST>
   649           <ST>
   594 <![CDATA[(* hereafter is a C pragma accessing FB interface in a clean way *)
   650 <![CDATA[(* hereafter is a C pragma accessing FB interface in a clean way *)
   595 {
   651 {{
   596   int toPLC;
   652   char toPLC;
   597   int fromPLC = __GET_VAR(data__->IN);
   653   char fromPLC = GetFbVar(IN);
   598   if(PLC_C_Call(fromPLC, &toPLC))__SET_VAR(data__->,OUT,toPLC);
   654   if(PLC_C_Call(fromPLC, &toPLC)){
   599 }
   655     SetFbVar(OUT, toPLC);
       
   656   }
       
   657   if(0){
       
   658     /* that code demonstrate C access to complex types */
       
   659     char somebyte = GetFbVar(COORDS, .table[3]);
       
   660     SetFbVar(SMURF, somebyte, .FIRSTBYTE);
       
   661     SetFbVar(COORDS, somebyte, .table[4]);
       
   662   }
       
   663 }}
   600 (* If you do not use __GET_VAR and _SET_VAR macro, expect unexpected *)
   664 (* If you do not use __GET_VAR and _SET_VAR macro, expect unexpected *)
   601 ]]>
   665 ]]>
   602           </ST>
   666           </ST>
   603         </body>
   667         </body>
   604       </pou>
   668       </pou>