331
ROR, RORP, RCR, RCRP
1
2
3
4
4
6
7
8
7.2
R
otation instr
uction
7.2.1
R
OR, RORP, RC
R, RCRP
RCR
(1) Rotates 16-bit data of the device designated by , including the carry flag, n-bits to the right.
The carry flag is ON or OFF depending on the status prior to the execution of the ROR instruction.
(2) When a bit device is designated for , a rotation is performed within the device range specified by digit specification.
The number of bits by which a rotation is executed is the remainder of n/(specified number of bits).
For example, when n 15 and (specified number of bits) 12 bits, the remainder of 15/12 1 is "3", and the data is
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 18, the contents are rotated two bits to the right since the remainder of 18 / 16 1 is "2".
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]
[List Mode]
[Operation]
D
b7
b15
b8
b1
4
b13 b12 b11 b10 b9
b6 b5 b
4
b3 b2 b1 b0
b7
b15
b8
b1
4
b13 b12 b11 b10 b9
b6 b5 b
4
b3 b2 b1 b0
b7
b15
b8
b1
4
b13 b12 b11 b10 b9
b6 b5 b
4
b3 b2 b1 b0
b7
b15
b8
b1
4
b13 b12 b11 b10 b9
b6 b5 b
4
b3 b2 b1 b0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
Carr
y
f
l
ag
(
SM700
)
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
D
D
D
D
Va
l
ue
of
carr
y
f
l
ag
Va
l
ue
of
carr
y
f
l
ag
Carr
y
f
l
ag
(
SM700
)
R
i
ght
rotat
i
on
(
1
b
i
t
)
R
i
ght
rotat
i
on
(
1
b
i
t
)
1
Va
l
ue
of
b0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
Carr
y
f
l
ag
(
SM700
)
0
Va
l
ue
of
b0
Carr
y
f
l
ag
(
SM700
)
R
i
ght
rotat
i
on
(
n
b
i
ts
)
Va
l
ue
of
b
(
n
-
1
)
D
Step
Instruction
Device
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
b15
b8
b0
b7
b0
b7
b15
b8
0
1
b1
4
b13 b12 b11b10 b9
b6 b5 b
4
b3 b2 b1
b1
4
b13 b12 b11b10 b9
b6 b5 b
4
b3 b2 b1
Carr
y
f
l
ag
(
SM700
)
Carr
y
f
l
ag
(
SM700
)
Contents
of
b2
to
b0
before
execut
i
on
Contents
of
b15
to
b
4
before
execut
i
on
Content
of
b3
before
execut
i
on
Content
of
b2
before
execut
i
on
D0
D0