7.2 Rotation Instructions
7.2.4 Left rotation of 32-bit data
7-39
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
DROL, DRCL
DROL, DRCL
(3) Specify any of 0 to 31 for n.
If the value specified for n is 32 or higher, the remainder of n divided by 32 is used for
rotation. For example, when n 34, the remainder of 34/32 1 is 2, thus the data are
rotated 2 bits to the left.
DRCL(P)
(1) Rotates 32-bit data of the device specified for
, including the carry flag, n bits to the left.
The carry flag turns ON or OFF depending on its status prior to the execution of the DRCL
instruction.
(2) When a bit device is specified for
, a rotation is performed within the device range
of points by digit specification. The number of bits that rotate is the remainder of n divided by
‘number of points by digit specification’.
For example, when n 31 and ‘number of points by digit specification’ 24 bits, the
remainder of 31/24 1 is 7, thus the data are rotated 7 bits.
(3) Specify any of 0 to 31 for n.
If the value specified for n is 32 or higher, the remainder of n divided by 32 is used for
rotation. For example, when n 34, the remainder of 34/32 1 is 2, the data are rotated 2
bits to the left.
O
peration Error
No operation error occurs in the execution of the DROL(P) and DRCL(P) instructions.
Program Example
(1) In the following program, the data in Var_D0 are rotated, not including the carry flag, 4 bits to
the left, when X0C turns ON.
[Structured ladder]
[ST]
DROLP(X0C,4,Var_D0);
[Operation]
d
b2
b16
b31
b17
b30 b29 b28 b27
b18
b15 b1
4
b5 b
4
b3
C
arr
y
flag
(SM700)
b1 b0
n-
b
it rotation
d
d
1
Var_D
0
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
0
Var_D
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 1 1 1 1
b31
b16
b0
b15
b28b27 b2
4
b23
b20b19
b12 b11
b8 b7
b
4
b3
C
ontents of
b31
to
b28
b
efore execution
C
ontents of
b27
to
b0
b
efore execution
0
1
C
arr
y
flag
(SM700)
C
arr
y
flag
(SM700)
C
ontent of
b28
b
efore execution
b31
b16
b0
b15
b28b27 b2
4
b23
b20b19
b12 b11
b8 b7
b
4
b3
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......