Try a PLC free — no signup
Data Movement & Bit ShiftingIntermediateIEC 61131-3

ROL (Rotate Left)

Rotates bits left; bits shifted out the left wrap around to the right.

The ROL (Rotate Left) function rotates the bits of the input value to the left by a specified number of positions. Unlike SHL, bits shifted out of the left end wrap around to the right end, so no data is lost. ROL is used for creating rotating bit patterns (sequencer outputs, LED chase patterns), implementing circular shift registers, and cyclic data manipulation.

Parameters

Inputs

NameTypeDescription
INANY_BITValue to rotate
NINTNumber of bit positions to rotate left

Outputs

NameTypeDescription
OUTANY_BITRotated result

Ladder Logic Example

// Ladder Logic - ROL (Sequencer Pattern)
//
// |----[ Step_Pulse ]----[ROL]----|
// |                      IN: Pattern     |
// |                      N:  1           |
// |                      OUT: Pattern    |

Structured Text Example

// Rotating LED chase pattern
IF Step_Pulse THEN
    LED_Pattern := ROL(LED_Pattern, 1);
END_IF;
// 0000_0001 -> 0000_0010 -> 0000_0100 -> ... -> 1000_0000 -> 0000_0001

Free · no signup to try

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use ROL instruction in TIA Portal.

AB

Allen-Bradley (Studio 5000)

No native ROL; implement using BSL with feedback from last bit.

C

CODESYS

Use ROL() function in ST.

Common Applications

  • LED chase/sequencer patterns
  • Circular shift registers
  • Rotating bit patterns for outputs
  • Cyclic data manipulation
  • Round-robin scheduling

Frequently Asked Questions

What is ROL (Rotate Left) in PLC programming?

Rotates bits left; bits shifted out the left wrap around to the right. The ROL (Rotate Left) function rotates the bits of the input value to the left by a specified number of positions. Unlike SHL, bits shifted out of the left end wrap around to the right end, so no data is lost.

What are common applications of ROL (Rotate Left)?

ROL (Rotate Left) is commonly used for: LED chase/sequencer patterns, Circular shift registers, Rotating bit patterns for outputs, Cyclic data manipulation, Round-robin scheduling.

How do I use ROL (Rotate Left) in different PLC platforms?

Siemens: Use ROL instruction in TIA Portal. Allen-Bradley: No native ROL; implement using BSL with feedback from last bit. CODESYS: Use ROL() function in ST.

Free · no signup to try

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad