Skip to main content

Example - Ladder Diagram

ROR


The ROR instruction will rotate the WORD value, D, n number of bits to the right. 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, D0, is 272.



When the contact, M0.0, is powered ON (1), the WORD data register, D0, rotates 3 bits to the right.



The value of the WORD data register, D0, changes from 272 to 34.



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, D0, changes from 34 to 16,388.



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, D0, changes from 16,388 to -30,720.



After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.

RORP


The RORP one-shot instruction will rotate the WORD value, D, n number of bits to the right. The result of the rotation is saved in the same assigned WORD data register, D.
Every time this instruction executes, it energizes the output only once.

Ladder Diagram Example


The initial value of the WORD data register, D2, is 9,031.



When the contact, M1.0, is powered ON (1), the WORD data register, D2, rotates 1 bit to the right.



The value of the WORD data register, D2, changes from 9,031 to -28,253.



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, D2, changes from -28,253 to -14,217.



After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1.