
Appendix D How to Use PLC Function
API
30
| Mnemonic |
| Operands | Function | |
|
|
|
|
|
|
| ROR |
| P | D, n | Rotate to the Right |
|
|
|
|
|
|
Type | Bit Devices |
|
| Word devices |
|
| Program Steps | ||||
OP | X | Y | M | K | H | KnX | KnY | KnM | T | C | D ROR, RORP: 5 steps |
| |||||||||||
D |
|
|
|
|
|
| * | * | * | * | * |
n |
|
|
| * | * |
|
|
|
|
|
|
Operands: |
|
|
|
|
|
|
|
|
|
|
|
D: Device to be rotated n: Number of bits to be rotated in 1 rotation
Explanations:
1.This instruction rotates the device content designated by D to the right for n bits.
2.This instruction adopts pulse execution instructions (RORP).
Program Example:
When X0 goes from Off to On, the 16 bits (4 bits as a group) in D10 will rotate to the right, as shown in the figure below. The bit marked with ※ will be sent to carry flag M1022.
| X0 |
|
|
|
|
|
| RORP |
| D10 |
| K4 |
|
|
|
|
| ||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||
|
|
|
|
|
|
| Rotate to the right |
|
|
|
|
|
|
|
| ||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||
D10 | upper bit |
|
|
|
|
|
|
|
|
|
|
| lower bit |
| Carry | ||||||||
|
|
|
|
|
|
|
|
|
|
|
| ||||||||||||
0 | 1 | 1 | 1 | 1 | 0 1 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 |
|
|
| ||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| flag |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 bits |
|
|
|
|
|
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
| After one rotation |
|
|
|
|
|
|
| ||||||
|
| upper bit |
|
|
|
| to the right |
|
| lower bit |
|
| |||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |||||||||
D10 | 0 | 1 | 0 | 1 0 | 1 |
| 1 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 | 0 |
|
| 0 | Carry | |||
|
| * |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| flag | |
API
31
| Mnemonic |
| Operands | Function | |
|
|
|
|
|
|
| ROL |
| P | D, n | Rotate to the Left |
|
|
|
|
|
|
Type | Bit Devices |
|
| Word devices |
|
| Program Steps | ||||
OP | X | Y | M | K | H | KnX | KnY | KnM | T | C | D ROL, ROLP: 5 steps |
| |||||||||||
D |
|
|
|
|
|
| * | * | * | * | * |
n |
|
|
| * | * |
|
|
|
|
|
|
Revision June 2008, 04EE, |