ROR¶
Rotates a bit string right by a specified number of positions.
Signature¶
┌─────────┐
IN ─┤ │
│ ROR ├─ OUT
N ─┤ │
└─────────┘
FUNCTION ROR : ANY_BIT
VAR_INPUT
IN : ANY_BIT;
N : ANY_INT;
END_VAR
END_FUNCTION
The return type matches the type of IN. ROR accepts BYTE,
WORD, DWORD, LWORD for IN; N is INT.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The bit string to rotate. |
|
|
Number of positions to rotate right. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
IN rotated right by N positions, with bits wrapping from the rightmost to the leftmost position. Same type as IN. |
Description¶
Rotates the bit string IN right by N positions. Bits shifted out of the rightmost position wrap around to the leftmost position. No bits are lost.
Example¶
result := ROR(WORD#16#000F, 4); (* result = 16#F000 *)
See Also¶
References¶
IEC 61131-3 §2.5.1.5.6