Rotate Right with Carry (WORD)
Instruction Parameters
Supported PLC Series
| XPnA/1R | XPnB | XPnE | XPnF | CP3A/B/P/U CP4A~D/U | CPnE | CPnF | BP | PLC-S |
|---|---|---|---|---|---|---|---|---|
| ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
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 WORD data registers. This is the value to rotate to the right. The result of the rotation will be saved here. The signed value range is -32,768 ~ 32,767 (216). The unsigned value range is 0 ~ 65,535 (216-1). The Hexadecimal value range is H0000 ~ HFFFF. |
| n | The second operand. Entries are WORD data registers or constants. This is the number of bits to rotate. The value range is 0 ~ 15. 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 RCR and RCRP instructions behave as follows:
- The value in the data register, D, is rotated to the right.
- 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 WORD 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 included in the rotation.
- n should be a value from 0 ~ 15.
- If n is greater than 15, the remainder from n ÷ 16 is the equivalent.
- Example: if n = 18, the remainder is 2.
- This is the same as n = 2.
- Example: if n = 18, the remainder is 2.
- If n is greater than 15, the remainder from n ÷ 16 is the equivalent.