FP_ROL_CARRY

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.

Parameters

Input

n_Bits (WORD, INT, UINT)

Number of bits

Values: 0–255

Input/output

d (WORD, DWORD)

Data to be rotated

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)

if the area specified using the index modifier exceeds the limit.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)

if the area specified using the index modifier exceeds the limit.

sys_bIsCarry (turns to TRUE for one scan)
  • 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.

Example

POU header

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

LD body

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

ST body

IF DF(start) then
    FP_ROL_CARRY(n_Bits := 4, d := wRotate_value);
END_IF;

Modified on: 2022-05-13Feedback on this pagePanasonic hotline