FP_WSHL_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 words specified by n_Words to the left (to the higher position) if the trigger EN is TRUE.

The vacant (empty) positions are filled with zeros.

Parameters

Input

n_Words (WORD, INT, UINT)

Number of words (permissible range: 0– 255)

Output

d1_Start (WORD)

Starting address

d2_End (WORD)

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_Words is out of range
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_Words is out of range

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*)
		awDataField: ARRAY [0..3] OF WORD:=[16#1001,16#1000,16#0011,16#1010];
			(*result after a 0->1 leading edge
from start: [2,0,3,4]*)
		iNumWords: INT:=0;
	END_VAR

LD body

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 := 7 ;
        NETWORK_BODY
B(B_VAROUT,,awDataField[1],19,3,21,5,);
B(B_VARIN,,iNumWords,7,3,9,5,);
B(B_CONTACT,,bStart,4,2,6,4,R);
B(B_F,FP_WSHL_BLOCK!,,9,1,19,6,,?DEN?Dn_Words?AENO?Cd1_Start?Cd2_End);
B(B_VAROUT,,awDataField[3],19,4,21,6,);
L(1,3,4,3);
L(6,3,9,3);
L(1,0,1,7);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF DF(bStart) then
    FP_WSHL_BLOCK(d1_Start := awDataField[1], 
                  d2_End => awDataField[3], 
                  n_Words => iNumWords);
END_IF;

Modified on: 2023-02-21Feedback on this pagePanasonic hotline