FP_SHL_BLOCK

Shift data block to the left

This FP instruction shifts the data range specified by d1_Start and d2_End by the number of bits specified by n_Bits to the left (to the higher position) if the trigger EN is TRUE.

The vacant (empty) positions are filled with zeros.

  • For n_Bits = 0, no shift takes place.

  • For n_Bits = 16, a shift of one word as with FP_WSHL_BLOCK occurs.

Parameters

Input

n_Bits (WORD, INT, UINT)

Number of bits (permissible range: 0–15)

Output

d1_Start (BOOL)

Starting address

d2_End (BOOL)

End address

Error flags

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

  • if n_Bits ³ 16

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

  • if n_Bits ³ 16

Example

Global variables

In the global variable list you define variables that can be accessed by all POUs in the project.

POU headerCopy code to clipboard

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*)
	END_VAR
	VAR_EXTERNAL
		bStartAddress: BOOL:=FALSE;
		bEndAddress: BOOL:=FALSE;
	END_VAR

LD bodyCopy code to clipboard

When the variable bStart changes from FALSE 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_SHL_BLOCK!,,9,1,18,6,,?DEN?Dn_Bits?AENO?Cd1_Start?Cd2_End);
B(B_VARIN,,3,7,3,9,5,);
B(B_VAROUT,,bStartAddress,18,3,20,5,);
B(B_VAROUT,,bEndAddress,18,4,20,6,);
B(B_CONTACT,,bStart,3,2,5,4,R);
L(1,3,3,3);
L(5,3,9,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST bodyCopy code to clipboard

IF DF(start) then
    FP_SHL_BLOCK(n_Bits := 4, 
                 d1_Start => awDataField[0], 
                 d2_End => awDataField[2]);
END_IF;

Modified on: 2023-05-09Feedback on this pagePanasonic hotline