SCL로 만든 DYNAMIC DWORD ARRAY SWAPPING FC

- SCL FC


- Test FC

- Result DB








- Source Code


 FUNCTION "DwordBlkSwap" : Void


{ S7_Optimized_Access := 'TRUE' }

VERSION : 0.1

VAR_INPUT

  realBlk : Array[*] OF Real;

END_VAR


VAR_OUTPUT

  swappedRealBlk : Array[*] OF Real;

END_VAR


VAR_IN_OUT


END_VAR


VAR_TEMP

  tempDword : DWord;

  size : DInt;

  start : DInt;

  cnt : DInt;

END_VAR


VAR CONSTANT


END_VAR





BEGIN

(*

  Author : Dongwon Kim, HMGICS Smart Maintenance

  Date : 2023.2.28

  Purpose : For dword array [any element] data swap and conversion 

*)

#size := UPPER_BOUND(ARR := #realBlk, DIM := 1);

#start := LOWER_BOUND(ARR := #realBlk, DIM := 1);

FOR #cnt := #start TO #size DO

  // Statement section FOR

  #tempDword := REAL_TO_DWORD(#realBlk[#cnt]);

  #tempDword := SWAP(#tempDword);

  #swappedRealBlk[#cnt] := DWORD_TO_REAL(#tempDword);

  

END_FOR;

END_FUNCTION


Comments

Popular posts from this blog

KEPWARE datalogger plug-in 에러 관련 팁