Rotate data to the right with carry flag
This FP instruction rotates the data specified by d to the right (to the lower bit position) by the number of bits specified by n_Bits and including the data of the carry flag if the trigger EN is TRUE.
Input
Number of bits
Values: 0–255
Input/output
Data to be rotated
if the area specified using the index modifier exceeds the limit.
if the area specified using the index modifier exceeds the limit.
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*)
wRotate_value: WORD:=16#1234;
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 := 5 ;
NETWORK_BODY
B(B_F,FP_ROR_CARRY!,,11,0,20,5,,?DEN?Dn_Bits?Dd?Ad?AENO);
B(B_CONTACT,,bStart,5,1,7,3,);
B(B_VARIN,,4,9,2,11,4,);
B(B_VARIN,,wRotate_value,9,3,11,5,);
L(1,2,5,2);
L(7,2,11,2);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(start) then
FP_ROR_CARRY(n_Bits := 4, d := wRotate_value);
END_IF;