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