MOVE_BYTESMove 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
Source data from which the byte is got
Byte offset relative to the first byte of the source data starting from 0, must be greater than or equal to 0
The number of bytes which are moved from source data to destination data, must be greater than or equal to 0
Byte offset relative to the first byte of the destination data starting from 0, must be greater than or equal to 0
Input/output
Destination data to which the bytes are written
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.

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
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
// 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;