Copy data to memory block
This FP instruction copies the data or equivalent constant specified by s to the memory block specified by d1_Start and d2_End if the trigger EN is TRUE.
Input
Source value to be copied
Output
Starting address of the destination data area
Ending address of the destination data area
The input and output variables have to be of the same data type.
The operands d1_Start and d2_End should be:
in the same memory area, e.g. DT, WR, FL, LD ...
d1_Start £ d2_End
if the area specified using the index modifier exceeds the limit.
if d1_Start > d2_End
Corresponding F instructions: F11_COPY
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;
(*activates the function*)
aiDataField: ARRAY [0..6] OF INT:=[1,3,5,7,9,11,13];
(*result after a 0->1 leading
edge from start:
[1,3,5,11,11,11,13]*)
END_VAR
When the variable bStart is set to TRUE, the function is carried out.
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_COPY!,,11,1,18,6,,?DEN?D@'s'?AENO?Cd1_Start?Cd2_End);
B(B_CONTACT,,bStart,3,2,5,4,);
B(B_VARIN,,11,9,3,11,5,);
B(B_VAROUT,,aiDataField[3],18,3,20,5,);
B(B_VAROUT,,aiDataField[5],18,4,20,6,);
L(1,3,3,3);
L(5,3,11,3);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF bStart then
(* Copy the value 11 to aiDataField[3], *)
(* aiDataField[4] and aiDataField[5] *)
FP_COPY(s := 11, d1_Start => aiDataField[3], d2_End => aiDataField[5]);
END_IF;