M800V/M80V Series PLC Programming Manual (1/2)
8 Function Instructions
8.7 Rotation Instructions
Operation errors
There are no arithmetic errors associated with DROR(P) or DRCR(P) instructions.
Program example
The following program rotates the contents of D0 and D1, not including the carry flag, 4 bits to the right when XC is ON.
M0
0
XC
4
8
b31
b28b27
D0,D1
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
Number of rotations
D11,D10
b31
b28b27
D0,D1
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 0 0 0 0
Contents of b3
through b0 prior to
execution
The following program rotates the contents of D0 and D1, including the carry flag, 4 bits to the right when XC is ON.
XC
0
4
b31
b28b27
b24b23
D0,D1
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
b28b27
b24b23
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
Contents of b2
through b0 prior to
execution
Contents of carry flag SM12 prior to execution
(*) The carry flag goes ON or OFF depending on its status prior to the execution of the DRCR instruction.
[Ladder mode]
DMOV K4 D10
DROR D0 D10
END
b24b23
b20b19
b16b15
b12b11
4
b24b23
b20b19
b16b15
b12b11
Contents of b31 through b4
prior to execution
[Ladder mode]
DRCRP D0 K4
END
b20b19
b16b15
b12b11
b20b19
b16b15
b12b11
Contents of b31 through b4
prior to execution
285
Steps
0
1
4
5
8
Carry flag
(SM12)
b8 b7
b4 b3
b0
0
Carry flag
(SM12)
b8 b7
b4 b3
b0
1
Contents of b3 prior to
execution
Steps
0
1
4
Carry flag
(SM12)
b8 b7
b4 b3
b0
*
Carry flag
(SM12)
b8 b7
b4 b3
b0
1
Contents of b3 prior to
execution
[List mode]
Inst.
Device
LD
M0
DMOV
K4
D10
LD
XC
DROR
D0
D10
END
[List mode]
Inst.
Device
LD
XC
DRCRP
D0
K4
END
IB-1501667-B