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.
Input
Number of words (permissible range: 0– 255)
Output
Starting address
End address
if d1_Start > d2_End
if d1_Start > d2_End
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
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
IF DF(bStart) then
FP_WSHL_BLOCK(d1_Start := awDataField[1],
d2_End => awDataField[3],
n_Words => iNumWords);
END_IF;