Shift data block to the right
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 right (to the lower 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 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 := 5 ;
NETWORK_BODY
B(B_VAROUT,,awDataField[3],19,3,21,5,);
B(B_VARIN,,iNumWords,7,2,9,4,);
B(B_CONTACT,,bStart,4,1,6,3,R);
B(B_F,FP_WSHR_BLOCK!,,9,0,19,5,,?DEN?Dn_Words?AENO?Cd1_Start?Cd2_End);
B(B_VAROUT,,awDataField[1],19,2,21,4,);
L(1,2,4,2);
L(6,2,9,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(bStart) then
FP_WSHR_BLOCK(d1_Start := awDataField[1],
d2_End => awDataField[3],
n_Words => iNumWords);
END_IF;