FP_DATA_READ_COMPRESS

Shift out and compress data

This FP instruction shifts out non-zero data stored at the highest address of the table to the specified area and compresses the data in the table to the higher address.

Parameters

Output

d1_Start (WORD, INT, UINT)

Starting (lowest) address of data to be compressed

d2_End (WORD, INT, UINT)

Final (highest) address of data to be compressed, data at d2_End is shifted out

d3 (WORD, INT, UINT)

Receives data shifted out from d2_End

Remarks

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

    • Contents of d2_End (highest address) are shifted out to the area specified by d3.

    • 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

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];
		iShiftoutData: INT:=10;
	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_READ_COMPRESS!,,10,1,24,7,,?DEN?AENO?Cd1_Start?Cd2_End?Cd3);
B(B_CONTACT,,bStart,5,2,7,4,);
B(B_VAROUT,,aiDataField[0],24,3,26,5,);
B(B_VAROUT,,aiDataField[5],24,4,26,6,);
B(B_VAROUT,,iShiftoutData,24,5,26,7,);
L(1,3,5,3);
L(7,3,10,3);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If (bStart) then
    FP_DATA_READ_COMPRESS(d1_Start => aiDataField[0], 
                          d2_End => aiDataField[5], 
                          d3 => iShiftoutData);
End_if;

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