Mitsubishi MELSEC-Q/L Programming Manual page 333

Table of Contents

Advertisement

RCR
(1) Rotates 16-bit data of the device designated by
The carry flag is ON or OFF depending on the status prior to the execution of the ROR instruction.
b15
D
b15
D
Value of carry flag
b15
D
Value of carry flag
b15
D
(2) When a bit device is designated for
The number of bits by which a rotation is executed is the remainder of n/(specified number of bits).
For example, when n
rotated 3 bits.
(3) Specify any of 0 to 15 as n.
If the value specified as n is 16 or greater, the remainder of n / 16 is used for rotation.
For example, when n
Operation Error
(1) There is no operation error in the ROR(P) or RCR(P) instruction.
Program Example
(1) The following program rotates the contents of D0, not including the carry flag, 3 bits to the right when XC is turned ON.
[Ladder Mode]
[Operation]
b15
b14 b13 b12 b11b10 b9
D0
0
0
0
0
0
0
b15
b14 b13b12 b11b10 b9
D0
1
1
1
0
0
0
Contents of b2 to b0
before execution
, including the carry flag, n-bits to the right.
D
b14 b13 b12 b11 b10 b9
b8
b7
0
0
0
0
0
0
0
0
0
b14 b13 b12 b11 b10 b9
b8
b7
0
0
0
0
0
0
0
0
0
b14 b13 b12 b11 b10 b9
b8
b7
1
0
0
0
0
0
0
0
0
b14 b13 b12 b11 b10 b9
b8
b7
, a rotation is performed within the device range specified by digit specification.
D
15 and (specified number of bits)
18, the contents are rotated two bits to the right since the remainder of 18 / 16
[List Mode]
Step
b8
b7
b6 b5 b4 b3 b2 b1
0
0
0
0
0
0
1
1
b8
b7
b6 b5 b4 b3 b2 b1
0
0
0
0
0
0
0
0
Contents of b15 to b4
before execution
ROR, RORP, RCR, RCRP
b6 b5 b4 b3 b2 b1 b0
0
0
0
0
1
0
1
Right rotation (1 bit)
b6 b5 b4 b3 b2 b1 b0
0
0
0
0
0
1
0
Right rotation (1 bit)
b6 b5 b4 b3 b2 b1 b0
0
0
0
0
0
0
1
Right rotation (n bits)
b6 b5 b4 b3 b2 b1 b0
12 bits, the remainder of 15/12
Instruction
Device
Carry flag
(SM700)
b0
1
1
0
Carry flag
(SM700)
b0
0
1
1
Content of b2
Content of b3
before execution
before execution
Carry flag
(SM700)
0
Carry flag
(SM700)
1
Value of b0
Carry flag
(SM700)
0
Value of b0
Carry flag
(SM700)
Value of b(n-1)
1 is "3", and the data is
1 is "2".
1
2
3
4
4
6
7
8
331

Advertisement

Table of Contents
loading

Table of Contents