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 DROL(P) or DRCL(P) instructions.
Program example
The following program rotates the contents of D0 and D1, not including the carry flag, 4 bits to the left when XC is ON.
M0
0
XC
4
8
Carry flag
(SM12)
b31
b28b27
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 0 0 0 0
Number of rotations
D11,D10
Carry flag
(SM12)
b31
b28b27
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 1 1 1 1
Contents of b28
prior to execution
The following program rotates the contents of D0 and D1, including the carry flag, 4 bits to the left when XC is ON.
XC
0
4
Carry flag
(SM12)
b31
b28b27
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
*
Carry flag
(SM12)
b31
b28b27
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 1 1 1 1
Contents of b28
prior to execution
(*) The carry flag goes ON or OFF depending on its status prior to the execution of the DRCL instruction.
[Ladder mode]
DMOV K4 D10
DROL D0 D10
END
b24b23
b20b19
b16b15
b12b11
4
b24b23
b20b19
b16b15
b12b11
Contents of b27 to b0
prior to execution
[Ladder mode]
DRCLP D0 K4
END
b24b23
b20b19
b16b15
b24b23
b20b19
b16b15
Contents of b27 to b0
prior to execution
287
Steps
0
1
4
5
8
b8 b7
b4 b3
b0
D0,D1
b8 b7
b4 b3
b0
D0,D1
Contents of b31 to b28
prior to execution
Steps
0
1
4
b12b11
b8 b7
b4 b3
b12b11
b8 b7
b4 b3
Contents of b31 to b29
prior to execution
Contents of carry flag SM12
prior to execution
[List mode]
Inst.
Device
LD
M0
DMOV
K4
D10
LD
XC
DROL
D0
D10
END
[List mode]
Inst.
Device
LD
XC
DRCLP
D0
K4
END
b0
D0,D1
b0
D0,D1
IB-1501667-B