Rotate data to the left with carry flag
This FP instruction rotates the data specified by d to the left (to the higher 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.
if d= 16-bit data and n_Bits is either 0 or a multiple of 17, no rotation occurs and the carry flag remains unchanged.
if d= 32-bit data and n_Bits is either 0 or a multiple of 33, no rotation occurs and the carry flag remains unchanged.
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 := 6 ;
NETWORK_BODY
B(B_F,FP_ROL_CARRY!,,11,1,20,6,,?DEN?Dn_Bits?Dd?Ad?AENO);
B(B_CONTACT,,bStart,3,2,5,4,);
B(B_VARIN,,4,9,3,11,5,);
B(B_VARIN,,wRotate_value,9,4,11,6,);
L(1,3,3,3);
L(5,3,11,3);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(start) then
FP_ROL_CARRY(n_Bits := 4, d := wRotate_value);
END_IF;