[SCL?] DIFFRENT DATATYPE ASSIGNMENT

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
frankw
Posts: 103
Joined: Tue Mar 06, 2007 5:59 am
Location: China

[SCL?] DIFFRENT DATATYPE ASSIGNMENT

Post by frankw »

Hi,

The compiled SCL :

Code: Select all

      L     D [AR1,P#128.0]; <-------point to DB1.Err.Err0, structure with 32 bool
      T     #Err_DW;<-----------------Dword data type
how to rewrite it in SCL ?

Code: Select all

       Err_DW := which_convert_function(DB1.Err.Err0)
Best Regards
frankw
Posts: 103
Joined: Tue Mar 06, 2007 5:59 am
Location: China

Post by frankw »

The code is part of EasyMotion 2.0 FB1 MC_MoveAbsolute:
compiled code:

Code: Select all

A7d6:   L     #Restweg
      T     #ziel
      L     #aufl
      /R    
      T     #ZielStrich
      L     DIW [AR2,P#22.0]
      T     LW    90
      TAK   
      OPN   DB [LW 90]
      L     DID [AR2,P#24.0]
      LAR1  
      TAK   
      L     D [AR1,P#128.0]
      T     #Err_DW
      CLR   
      =     L     84.0
      =     L     84.1
rewrite it in SCL:

Code: Select all

VAR_TEMP
  ........
  Err_DW : DWORD ;    //internal use
  Err_DW_Bit AT Err_DW: ARRAY [0..31]OF BOOL;   //BIT VIEW OF DWORD
END_VAR;


            ziel := Restweg; 
            ZielStrich := Restweg/aufl; 
            Err_DW := Axis.Err;//*******NEED CORRECTION!*************
            Err_DW_Bit[0] := FALSE;
            Err_DW_Bit[1] := FALSE ;
help me, please.
frankw
Posts: 103
Joined: Tue Mar 06, 2007 5:59 am
Location: China

Post by frankw »

now it work:

Code: Select all

               TEMP_VAR
                   ....
               Err_DW : DWORD ;   
               Err_Struct AT Err_DW :STRUCT // ADDED same as DB1.Err;
                    ....
               END_STRUECT;
               END_VAR;

                Err_Struct := DB1.Err;
 

After compiled:

Code: Select all

       L     D [AR1,P#128.0]
       T     #Err_DW