Example - Ladder Diagram
ROL
The ROL instruction will rotate the WORD value, D, n number of bits to the left. The result of the rotation is saved in the same assigned WORD data register, D.
Ladder Diagram Example
The initial value of the WORD data register, D100, is 15,360.
![]()
When the contact, M10.0, is powered ON (1), the WORD data register, D100, rotates 2 bits to the left.
The value of the WORD data register, D0, changes from 15,360 to -4,096.
![]()
After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.
When the instruction is reenergized, the value of the WORD data register, D100, changes from -4,096 to -16,381.
![]()
After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.
ROLP
The ROLP one-shot instruction will rotate the WORD value, D, n number of bits to the left. The result of the rotation is saved in the same assigned WORD data register, D.
Every time this instruction energizes, it executes only once.
Ladder Diagram Example
The initial value of the WORD data register, D110, is -16,383.
When the contact, M11.0, is powered ON (1), the WORD data register, D110, rotates 1 bit to the left.
The value of the WORD data register, D110, changes from -16,383 to -32,765.
![]()
After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.
When the instruction is reenergized, the value of the WORD data register, D110, changes from -32,765 to 7.
After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.
When the instruction is reenergized, the value of the WORD data register, D110, changes from 7 to 14.
After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.