7. APPLICATION INSTRUCTIONS
7 − 26
MELSEC-A
Program Examples ROL
Program which rotates the contents of A0 three bits to the left when XC turns on.
RCL
Program which rotates the contents of A0 three bits to the left when XC turns on.
Contents of B15
before execution
Contents of B15
when n = 1
Contents of B15
when n = 2
Carry flag
(M9012)
To B0
To B0
To B0
(n = 1)
(n = 2)
(n = 3)
Before execution
Pro
ress
After execution
* Before execution, carry flag is either 1 or 0.
X00C
PK
ROL 3
0
• Coding
0 LD X0
1 ROLP K3
4 END
X00C
PK
RCL 3
0
• Coding
0 LD X00C
1 RCLP K3
4 END
Carry flag
(M9012)
* Before execution, carry flag is either 1 or 0.
To carry flag
To carry flag
To carry flag
(n = 1)
(n = 2)
(n = 3) After execution
Progress
Before execution