FP_COPY

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.

Parameters

Input

s (INT, UINT, WORD, DINT, UDINT, DWORD, REAL, DATE, TOD, DT)

Source value to be copied

Output

d1_Start (INT, UINT, WORD, DINT, UDINT, DWORD, REAL, DATE, TOD, DT)

Starting address of the destination data area

d2_End (INT, UINT, WORD, DINT, UDINT, DWORD, REAL, DATE, TOD, DT)

Ending address of the destination data area

Remarks

  • 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

Error flags

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

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if d1_Start > d2_End

Related topics:

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;
			(*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

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_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

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

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