Skip to main content

Example - Ladder Diagram

DROL


The DROL instruction will rotate the DWORD value, D, n number of bits to the left. The result of the rotation is saved in the same assigned DWORD data register, D.

Ladder Diagram Example


The initial value of the DWORD data register, D120, is 704,694,278.



When the contact, M12.0, is powered ON (1), the DWORD data register, D120, rotates 3 bits to the left.



The value of the DWORD data register, D120, changes from 704,694,278 to 1,342,586,929.



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



When the instruction is reenergized, the value of the DWORD data register, D120, changes from 1,342,586,929 to -2,144,206,454.



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

DROLP


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

Ladder Diagram Example


The initial value of the DWORD data register, D130, is -8,060,778.



When the contact, M13.0, is powered ON (1), the DWORD data register, D130, rotates 3 bits to the left.



The value of the DWORD data register, D130, changes from -8,060,778 to -64,486,217.



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