Instruction Parameters
Supported PLC Series
| PLC-AES | PLC-FB | PLC-ES |
|---|---|---|
| ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| D | ✓ | – | ✓ | ✓ | ✓ | – | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | – |
| n | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | – |
| Carry | F11.2 | ✓ |
Number of Steps
| Steps |
|---|
| 3 |
Operands
| Operand | Description |
|---|---|
| D | The first operand. Entries are only DWORD data registers. This is the value to rotate to the left. The result of the rotation will be saved here. The signed value range is -2,147,483,648 ~ 2,147,483,647 (232). The unsigned value range is 0 ~ 4,294,967,295 (232-1). The Hexadecimal value range is H00000000 ~ HFFFFFFFF. |
| n | The second operand. Entries are DWORD data registers or constants. This is the number of bits to rotate. The value range is 0 ~ 31. The remainder n ÷ 16 will be the result of n if the value of n is greater than 15. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type. F11.0 turns ON when the value of the data for a rotation exceeds the data register assigned to D.
Carry Flag (F11.2) Notice
The carry flag, F11.2, will be ON for one scan when the operation result overflows.
Instruction Behavior
The DROL and DROLP instructions behave as follows:
- The value in the data register, D, is rotated to the left.
- The value is rotated from the most significant bit to the least significant bit.
- The least significant bit rotates to the carry flag, F11.2.
- The most significant bit rotates in a range of D‘s DWORD value.
- The carry flag turns ON when 1 is rotated into the carry flag, F11.2.
- When the instruction energizes, data stored in the carry flag, F11.2, is NOT included in the rotation.
- IMG images/01-drol-notice-example-b.webp – n should be a value from 0 ~ 31. Notice
- n should be a value from 0 ~ 31.
- If n is greater than 31, the remainder from n ÷ 32 is the equivalent.
- Example: if n = 34, the remainder is 2.
- This is the same as n = 2.
- Example: if n = 34, the remainder is 2.
- If n is greater than 31, the remainder from n ÷ 32 is the equivalent.
Ladder Diagram Examples
DROL

The DROL instruction will rotate the DWORD value, D, n number of bits to the left. The result of the rotation is saved in the same assigned DWORD data register, D.

The initial value of the DWORD data register, D120, is 704,694,278.

When the contact, M12.0, is powered ON (1), the DWORD data register, D120, rotates 3 bits to the left.

The value of the DWORD data register, D120, changes from 704,694,278 to 1,342,586,929.

After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.

When the instruction is reenergized, the value of the DWORD data register, D120, changes from 1,342,586,929 to -2,144,206,454.

After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.
DROLP

The DROLP one-shot instruction will rotate the DWORD value, D, n number of bits to the left. The result of the rotation is saved in the same assigned DWORD data register, D. Every time this instruction energizes, it executes only once.

The initial value of the DWORD data register, D130, is -8,060,778.

When the contact, M13.0, is powered ON (1), the DWORD data register, D130, rotates 3 bits to the left.

The value of the DWORD data register, D130, changes from -8,060,778 to -64,486,217.

After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.
