336
DROR, DRORP, DRCR, DRCRP
DRCR
(1) Rotates 32-bit data, including carry flag, at device designated by n bits to the right.
The carry flag goes ON or OFF depending on its status prior to the execution of the DRCR 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 31 and (specified number of bits) 24 bits, the remainder of 31/24 1 is "7", and the data is
rotated 7 bits.
(3) Specify any of 0 to 31 as n. If the value specified as n is 32 or greater, the remainder of n / 32 is used for rotation. For
example, when n 34, the contents are rotated two bits to the right since the remainder of 34 / 32 1 is "2".
Operation Error
(1) There is no operation error in the DROR(P) or DRCR(P) instruction.
Program Example
(1) The following program rotates the contents of D0 and D1, not including the carry flag, 4 bits to the right when XC is ON.
[Ladder Mode]
[List Mode]
[Operation]
(2) The following program rotates the contents of D0 and D1, including the carry flag, 4 bits to the right when XC is ON.
[Ladder Mode]
[List Mode]
[Operation]
D
b2
b16
b31
b17
b30 b29 b28 b27
b18
b15 b14
b5 b4 b3
Carr
y
flag
(
SM700
)
b1 b0
D
D
n-bit rotation
+1
D
Step
Instruction
Device
0
D0
,
D1 0
0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1
D0
,
D1 1
1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
b31
b16
b0
b15
b28 b27
b2
4
b23
b20b19
b12 b11
b8 b7
b
4
b3
Contents
of
b3
to
b0
before
execut
i
on
b31
b16
b0
b15
b28 b27
b2
4
b23
b20 b19
b12 b11
b8 b7
b
4
b3
Contents
of
b31
to
b
4
before
execut
i
on
0
1
Carr
y
f
l
ag
(
SM700
)
Carr
y
f
l
ag
(
SM700
)
Content
of
b3
before
execut
i
on
Step
Instruction
Device
0
D0
,
D1 0
*
*
0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1
D0
,
D1 1
1
0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
b31
b16
b0
b15
b28b27 b2
4
b23
b20b19
b12b11
b8b7
b
4
b3
Before
execut
i
on
1
Carr
y
f
l
ag
(
SM700
)
Carr
y
f
l
ag
(
SM700
)
Content
of
b3
before
execut
i
on
Content
of
carr
y
f
l
ag
SM700
before
execut
i
on
Contents
of
b2
to
b0
before
execut
i
on
b31
b16
b0
b15
b28b27 b2
4
b23
b20b19
b12b11
b8b7
b
4
b3
* :
O
N/
O
FF
status
of
the
carr
y
f
l
ag
depends
on
i
ts
status
before
the
execut
i
on
of
DRCR
.