Skip to main content

7.5.3 ROR

Function

Circular right shift, move the operand input in IN to the right by N bits in binary bits, and add the overflow bits on the right to the left. Finally, the result is output in OUT

LD graphics

  • Alt text

  • As shown in the figure below, it illustrates how to rotate the integer data type operand to the right by 4 bits:

alt text

Parameter description

Interface variableDeclarationData typeDescription
INVar_InputANY_BITThe operand to be rotated right
NVar_InputANY_INTNumber of digits to rotate right
Function nameReturn valueANY_BITValue after circular right shift
warning
  • Here ANY_BIT data type is BYTE, WORD, DWORD, LWORD;
  • BOOL has no meaning, the return value type is the same as IN type

Example

  • LD example is shown below:

alt text

  • ST example is shown in the following code:
wVar:=ROR(IN:=wVar,N:=nVar);