A PLC shift register is one of the most powerful and frequently used instructions in industrial automation. It allows programmers to track the status of inputs, move data sequentially through bit positions, and create complex sequencing logic with minimal code. Whether you are controlling a conveyor system, managing a parts rejection line, or building a traffic light sequence, the shift register is a fundamental tool in every PLC programmer’s toolkit.
In this comprehensive guide, we will explore the concept of shift registers, how they function inside the CPU of a programmable logic controller, the different types available, practical applications, ladder logic examples, and best practices for implementation in modern manufacturing environments.
What Is a PLC Shift Register?
A shift register is a sequential logic function that moves (or “shifts”) a group of bits one position at a time, either to the left or to the right, on each clock pulse. In a PLC, this function is implemented either through a dedicated instruction block or by using a word of memory (a data register) where each individual bit represents a step in a sequence.
The most common shift register instructions in PLC platforms include:
- SFTR (Shift Right) – moves bits toward the least significant bit position.
- SFTL (Shift Left) – moves bits toward the most significant bit position.
- SFR / SFL – Allen-Bradley (Rockwell) terminology for shift right and shift left.
- BSFL / BSFR – Bit Shift Left / Bit Shift Right in ControlLogix platforms.
- SHL / SHR – Generic word-level shift functions.
How a Shift Register Works in Ladder Logic
The basic idea is straightforward. Imagine a row of 16 bits stored in a single word of PLC memory. Each time a trigger (clock) signal occurs, every bit moves one position. A new bit is loaded into either the leftmost or rightmost position, and the bit that “falls off” the end is discarded.
A typical shift register instruction requires four control inputs:
- Enable (EN) – Activates the instruction.
- Data Input – The new bit to be loaded at each shift (0 or 1).
- Clock / Trigger – The pulse that causes the shift to occur.
- Reset – Clears all bits in the register to zero.
Shift Register Direction Comparison
Choosing the right shift direction is critical for proper sequence tracking. The table below summarizes the difference between shift left and shift right operations.
| Parameter | Shift Left (SFTL / SFL) | Shift Right (SFTR / SFR) |
|---|---|---|
| Bit Movement | From least significant toward most significant bit | From most significant toward least significant bit |
| New Bit Entry | Enters at lowest bit position | Enters at highest bit position |
| Common Use | Tracking products as they move forward in a process | Reversed flow or reject detection at the start of a line |
| Typical Instruction | SFTL, SFL, BSFL | SFTR, SFR, BSFR |
Practical Applications in Industry
Shift registers are used across countless industries. The following examples represent the most common real-world scenarios.
1. Conveyor Tracking Systems
On a bottling line, photoelectric sensors detect bottles as they enter and exit stations. A shift register records the presence of each bottle, so downstream equipment knows exactly when to fill, cap, or label. This provides non-stop tracking without complex encoder or RFID hardware.
2. Reject / Quality Control Systems
If a defective product is detected at an inspection station, its status bit is shifted through the register as it travels down the line. When the bit reaches the position corresponding to the rejection cylinder, the product is automatically pushed off the conveyor.
3. Sequential Machine Operations
Many machines require a series of timed steps such as clamp, drill, tap, and eject. A shift register can advance one step per cycle, automatically moving to the next step until the sequence completes and then resetting for the next part.
4. Traffic Light Simulation
Educational PLC trainers frequently use shift registers to simulate traffic light patterns, where each bit position represents a different lamp or direction in the cycle.
Shift Register vs. Other Sequencing Methods
| Method | Best For | Pros | Cons |
|---|---|---|---|
| Shift Register | Tracking moving products | Simple, compact, fast | Limited to fixed length |
| Sequencer (SQC / SQO) | Step-based output patterns | Reads from a recipe table | Slightly more setup |
| Drum Sequencer | Mechanical cam replacement | Visual, easy to edit | Less flexible |
| State Machine / SFC | Complex multi-branch logic | Highly flexible | More programming effort |
⚠️ Important Tip: Always use a one-shot (rising edge) contact for the clock input of a shift register. If you connect a continuously ON signal, the register will shift thousands of times in a single PLC scan, destroying your data. Use the OSR, ONS, or P_TRIG instruction depending on your PLC brand.
Step-by-Step Example: Bottle Tracking on a Conveyor
Suppose we have three stations on a conveyor: Fill, Cap, and Label. Each station has a sensor that detects when a bottle arrives. We want to track the bottle’s progress using a shift register.
- Create a 16-bit data word, for example B3:0.
- When the entry sensor detects a bottle, set bit B3:0/0 = 1.
- Use a shift-left instruction triggered by a “one bottle moved” pulse from a prox sensor downstream.
- When B3:0/3 = 1, the bottle is at the Fill station.
- When B3:0/6 = 1, the bottle is at the Cap station.
- When B3:0/9 = 1, the bottle is at the Label station.
- Each station
