MOVE_BYTES

Move byte data

This function moves a number of bytes denoted by iNumberOfBytes from source data denoted by SourceData with a source byte offset iSourceByteOffset to destination data denoted by DestData with a destination byte offset iDestByteOffset.

The source byte offset and the destination byte offset are relative to the first byte starting from 0.

Input

SourceData (ANY) all simple and derived data types (ARRAYs, DUTs) which do not contain BOOL data

Source data from which the byte is got

iSourceByteOffset (INT, DINT, UINT, UDINT)

Byte offset relative to the first byte of the source data starting from 0, must be greater than or equal to 0

iNumberOfBytes (INT, DINT, UINT, UDINT)

The number of bytes which are moved from source data to destination data, must be greater than or equal to 0

iDestByteOffset (INT, DINT, UINT, UDINT)

Byte offset relative to the first byte of the destination data starting from 0, must be greater than or equal to 0

Input/output

DestData (ANY) all simple and derived data types (ARRAYs, DUTs) which do not contain BOOL data

Destination data to which the bytes are written

Remarks

  • Please check the validity of the input data since Control FPWIN Pro7 does not check the validity of the data to access.

  • Make sure that the source byte area and the destination byte area do not overlap.

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
		bMoveToWordBoundary: BOOL:=FALSE;
		awSourceByteData: ARRAY [0..7] OF WORD:=[16#6160,16#6362,16#6564,16#6766,16#6968,16#6b6a,16#6d6c,16#6f6e];
		awDestByteData: ARRAY [0..7] OF WORD:=[8(16#FFFF)];
		iSourceByteOffset3: INT:=3;
		iDestByteOffset9: INT:=9;
		iNumberOfBytes5: INT:=5;
		iNumberOfBytes4: INT:=4;
		bMoveFromWordBoundary: BOOL:=FALSE;
	END_VAR

LD body

When the variable bMoveToWordBoundary or bMoveFromWordBoundary is set to TRUE, the function is carried out.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 10 ;
        NETWORK_BODY
B(B_COMMENT,,Move bytes to word boundary:,1,0,29,1,);
B(B_CONTACT,,bMoveToWordBoundary,8,3,10,5,);
B(B_F,E_MOVE_BYTES!,,19,2,30,10,,?DEN?DSourceData?DiSourceByteOffset?DiNumberOfBytes?DiDestByteOffset?DDestData?ADestData?AENO);
B(B_VARIN,,awSourceByteData,17,4,19,6,);
B(B_VARIN,,iSourceByteOffset3,17,5,19,7,);
B(B_VARIN,,iNumberOfBytes5,17,6,19,8,);
B(B_VARIN,,2,17,7,19,9,);
B(B_VARIN,,awDestByteData,17,8,19,10,);
L(1,0,1,10);
L(1,4,8,4);
L(10,4,19,4);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 10 ;
        NETWORK_BODY
B(B_COMMENT,,Move bytes from word boundary:,1,0,29,1,);
B(B_CONTACT,,bMoveFromWordBoundary,8,3,10,5,);
B(B_F,E_MOVE_BYTES!,,19,2,30,10,,?DEN?DSourceData?DiSourceByteOffset?DiNumberOfBytes?DiDestByteOffset?DDestData?ADestData?AENO);
B(B_VARIN,,awSourceByteData,17,4,19,6,);
B(B_VARIN,,2,17,5,19,7,);
B(B_VARIN,,iNumberOfBytes4,17,6,19,8,);
B(B_VARIN,,iDestByteOffset9,17,7,19,9,);
B(B_VARIN,,awDestByteData,17,8,19,10,);
L(1,0,1,10);
L(1,4,8,4);
L(10,4,19,4);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

// Move bytes to word boundary:
if (bMoveToWordBoundary) then
	MOVE_BYTES(	SourceData := awSourceByteData, 
				iSourceByteOffset := iSourceByteOffset3, 
				iNumberOfBytes := iNumberOfBytes5, 
				iDestByteOffset := 2, 
				DestData := awDestByteData);
end_if;

// Move bytes from word boundary:
if (bMoveFromWordBoundary) then
	MOVE_BYTES(	SourceData := awSourceByteData, 
				iSourceByteOffset := 2, 
				iNumberOfBytes := iNumberOfBytes4, 
				iDestByteOffset := iDestByteOffset9, 
				DestData := awDestByteData);
end_if;

Modified on: 2025-06-05Feedback on this pagePanasonic hotline