M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.7 Rotation Instructions
Operation errors
There are no arithmetic errors associated with the ROL(P) or RCL(P) instructions.
Program example
The following program rotates the contents of D0, not including the carry flag, 3 bits to the left when XC is ON.
XC
0
4
Carry flag
(SM12)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
0
Carry flag
(SM12)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
1
Contents of b13
prior to execution
Contents of b12
prior to execution
The following program rotates the contents of D0, including the carry flag, 3 bits to the left when XC is ON.
XC
0
4
Carry flag
(SM12)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
*
1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0
Carry flag
(SM12)
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
1
1 0 0 0 0 0 0 0 0 0 0 0 0 *
Contents of b13
prior to execution
Contents of b12
prior to execution
(*) The carry flag goes ON or OFF depending on its status prior to the execution of RCL instruction.
[Ladder mode]
ROL D0 K3
END
1
1 1
0
0 0
0
0 0
0
0 0
0
0 0
0
0 0
Contents of b11 to b0
prior to execution
[Ladder mode]
RCLP D0 K3
END
Contents of b11 to b0
prior to execution
Steps
0
1
4
0
0 0
0
0 0
D0
0
0 0
1
1 1
D0
Contents of b15 to b13
prior to execution
Steps
0
1
4
D0
1 1
D0
Contents of b15 and
b14 prior to execution
Content of carry flag SM12
283
[List mode]
Inst.
Device
LD
XC
ROL
D0
K3
END
[List mode]
Inst.
Device
LD
XC
RCLP
D0
K3
END
IB-1501667-B