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 ROR(P) or RCR(P) instructions.
Program example
The following program rotates the contents of D0, though not including the carry flag, 3 bits to the right when XC is ON.
XC
0
4
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
D0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
D0
1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 1
Contents of b2 through
Contents of b15 through
b0 prior to execution
b4 prior to execution
The following program rotates the contents of D0, including the carry flag, 3 bits to the right when XC is ON.
XC
0
4
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
D0
0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1
b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b1 b0
D0
1 1
*
0 0 0 0 0 0 0 0 0 0 0 0 1
Contents of b1 and b0
prior to execution
Contents of carry flag SM12
(*) The carry flag goes ON or OFF depending on its status prior to the execution of RCR.
[Ladder mode]
ROR D0 K3
END
Carry flag
(SM12)
Carry flag
(SM12)
Contents of b2
prior to execution
Contents of b3
prior to execution
[Ladder mode]
RCRP D0 K3
END
Contents of b15 through
b4 prior to execution
Contents of b3
prior to execution
281
Steps
0
1
4
0
1
Steps
0
1
4
Carry flag
(SM12)
*
Carry flag
(SM12)
1
Contents of b2
prior to execution
[List mode]
Inst.
Device
LD
XC
ROR
D0
K3
END
[List mode]
Inst.
Device
LD
XC
RCRP
D0
K3
END
IB-1501667-B