334
ROL, ROLP, RCL, RCLP
RCL
(1) Rotates the 16-bit data of the device designated by , 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 RCL 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 data is rotated 2 bits to the left since the remainder of 18/16 1 is "2".
Operation Error
(1) There is no operation error in the ROL(P) or RCL(P) instruction.
Program Example
(1) The following program rotates the contents of D0, not including the carry flag, 3 bits to the left when XC is turned ON.
[Ladder Mode] [List Mode]
[Operation]
D
0
1001000 0 0
0
000
0
0
Carry flag
(SM700)
D
0
0010000 0 0
0
000
0
D
Value of carry flag
Value of carry flag
0
Carry flag
(SM700)
Left rotation (1 bit)
Left rotation (1 bit)
1
0
0
Value of b15
0
1000000 0 0
0
000
0
D
Carry flag
(SM700)
1
Value of b15
D
Carry flag
(SM700)
Left rotation (n bits)
Value of b(16-n)
b9
b15 b10b14 b13 b12 b11 b8
b7
b6 b5 b4 b3 b2 b1 b0
b9
b15 b10b14 b13 b12 b11 b8
b7
b6 b5 b4 b3 b2 b1 b0
b9
b15 b10b14 b13 b12 b11 b8
b7
b6 b5 b4 b3 b2 b1 b0
b9
b15 b10b14 b13 b12 b11 b8
b7
b6 b5 b4 b3 b2 b1 b0
D
Step Instruction Device
000000000000
111
1
1000000000000
1
1
b15 b8 b0b7
b0b7b15
b8
0
1
b14b13b12 b11b10 b9 b6 b5 b4 b3 b2 b1
b14b13b12 b11b10 b9 b6 b5 b4 b3 b2 b1
Carry flag
(SM700)
Carry flag
(SM700)
Contents of b15 to b13
before execution
Contents of b11 to b0
before execution
Content of b12
before execution
Content of b13
before execution
D0
D0
1