Learn PLCs free
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

20 Production-Ready Ladder Logic Templates

Stop writing the same rungs from scratch. Get copy-paste-ready templates for motor control, PID loops, safety interlocks, conveyors, and more.

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.

Stop Writing Ladder Logic From Scratch

Get 20 production-ready ladder logic templates for $29 -- download instantly and use them on your next project today.

20
Ready-Made Templates
LD + ST
Both Languages Included
$29
One-Time Purchase
Get Instant Access -- $29

Instant download - 30-day money-back guarantee - Use on unlimited projects

Free PLC simulator

Wire this block up and run it

Drop the instruction into a rung, hit Run, and watch it execute in your browser. 12 guided lessons across 8 PLC dialects — free account, no credit card.

Practice PLCs free →