FP_UNIFY_BYTES

Byte combination

This FP instruction unifies the number of bytes specified at n_Bytes of the data starting at s_Start if the trigger EN is TRUE. The result is stored in d.

Parameters

Input

s_Start (WORD)

Input value

n_Bytes (INT, DINT, UINT, UDINT)
  • Number of bytes to be unified, range: 0–65535

  • For n_Bytes=0, the instruction is not executed

  • Unused portions of the memory area are filled with zeros.

Output

d (WORD, DWORD)

Result

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if the area specified using the index modifier exceeds the limit.

  • if the value at n_Bytes is out of range

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if the area specified using the index modifier exceeds the limit.

  • if the value at n_Bytes is out of range

Example

  1.  (1) Offset 0
  2.  (2) Offset 1
  3.  (3) Offset 2

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		bStart: BOOL:=FALSE;
		dwSourceData: DWORD:=0;
		dwResult: DWORD:=0;
	END_VAR

POU body

When the variable bStart is set to TRUE, the function is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_F,FP_UNIFY_BYTES!,,14,1,23,6,,?DEN?Ds_Start?Dn_Bytes?AENO?Cd);
B(B_VARIN,,dwSourceData,12,3,14,5,);
B(B_VARIN,,3,12,4,14,6,);
B(B_VAROUT,,dwResult,23,3,25,5,);
B(B_CONTACT,,bStart,5,2,7,4,);
L(1,3,5,3);
L(7,3,14,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF (bStart) then
   FP_UNIFY_BYTES(s_Start := dwSourceData,
                  n_Bytes := 4,
                  d => dwResult);
END_IF;

Modified on: 2019-01-23Feedback on this pagePanasonic hotline