Shift data block to the right
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 right (to the lower bit 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_WSHR_BLOCK occurs.
Input
Number of bits (permissible range: 0–15)
Output
Starting address
End address
if d1_Start > d2_End
if n_Bits ³ 16
if d1_Start > d2_End
if n_Bits ³ 16
In the global variable list you define variables that can be accessed by all POUs in the project.
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
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_VARIN,,3,6,3,8,5,);
B(B_CONTACT,,bStart,3,2,5,4,R);
B(B_F,FP_SHR_BLOCK!,,8,1,17,6,,?DEN?Dn_Bits?AENO?Cd1_Start?Cd2_End);
B(B_VAROUT,,bStartAddress,17,3,19,5,);
B(B_VAROUT,,bEndAddress,17,4,19,6,);
L(1,3,3,3);
L(5,3,8,3);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(start) then
FP_SHR_BLOCK(n_Bits := 3,
d1_Start => bStartAddress,
d2_End => bEndAddress);
END_IF;