8. Function Commands
ROL, ROLP
- 259 -
Program example
Program to rotate the D10 data 3 bits to the left when M0 turns ON.
Coding
No. of
steps
Com-
mand
Device
10 LD M0
11 ROL D10 K3
D10ROL K3
M0
10
(Pulse coding)
14
B15 B14 B13 B12 B11 B10 B9 B8 B7 B6 B5 B4 B3 B2 B1 B0
10
0
00 000
0
0
0
00 0
0
0
1
0000 0 0
0
00000 0
001
Carry flag
(SM12)
D10 before execution
D10 after execution (n=3)
0
0000 0 0
0
000000
01
0
0000000
0
0000 00
10
0
To B0
To B0
To B0
B15
when n=1
B15
when n=2
Transition
*
(n=2)
(n=1)
*The carry flag is set to 1 or 0 after execution.
B15
before execution
Left rotation of data using ROL command