FP_DATA_WRITE_COMPRESS

Shift in and compress data

This FP instruction shifts in data to the smallest address of the specified data table and compresses the data in the table toward the higher address.

Parameters

Input

s (WORD, INT, UINT)

Data to be shifted in

Output

d1_Start (WORD, INT, UINT)

Starting address of area that is compressed into which data from s is shifted

d2_End (WORD, INT, UINT)

Ending address of area where data is compressed

Remarks

  • The data in the table specified by d1_Start and d2_End is rearranged as follows:

    • Data specified by s is shifted in to the area specified by d1_Start (starting address).

    • Non-zero data is shifted (compressed) in sequential order, in the direction of the higher address in the specified range.

  • Starting area d1_Start and ending area d2_End should be the same type of operand.

  • d1_Start must be £d2_End

  • If the content of s is "0", only a compressed shift is carried out.

Error flags

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

  • if the address of the variable at input s1_Start > s2_End

  • if s1_Start and s2_End belong to different data areas.

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

  • if the address of the variable at input s1_Start > s2_End

  • if s1_Start and s2_End belong to different data areas.

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;
		aiDataField: ARRAY [0..5] OF INT:=[555,444,0,11,0,10];
		iShiftinData: INT:=32;
	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 := 7 ;
        NETWORK_BODY
B(B_F,FP_DATA_WRITE_COMPRESS!,,9,1,23,6,,?DEN?D@'s'?AENO?Cd1_Start?Cd2_End);
B(B_CONTACT,,bStart,5,2,7,4,);
B(B_VARIN,,iShiftinData,7,3,9,5,);
B(B_VAROUT,,aiDataField[0],23,3,25,5,);
B(B_VAROUT,,aiDataField[5],23,4,25,6,);
L(1,3,5,3);
L(7,3,9,3);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If (bStart) then
    FP_DATA_WRITE_COMPRESS(s := iShiftinData, 
                           d1_Start => aiDataField[0], 
                           d2_End => aiDataField[5]);
End_if;

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