Understanding Shift Registers in Mitsubishi PLC – SFR, SFL, BSFR, and BSFL Instructions
In Mitsubishi PLC programming, shift register instructions play a crucial role in applications like conveyor tracking and object sequencing. In this guide, we’ll break down the Mitsubishi PLC SFR instruction, SFL instruction, and their bit-level counterparts — BSFR and BSFL — to help you understand how to manage data shifts effectively.
In digital electronics, a shift register is a memory element that allows bits to be shifted left or right. This concept is widely used in industrial automation systems, especially in Mitsubishi PLC programming, where data needs to be moved in sequence for applications like conveyor belts, packaging machines, and sorting systems.
Mitsubishi PLCs (such as the FX5U, FX3U, and Q-Series) provide specialized shift register instructions — SFR, SFL, BSFR, and BSFL — that help programmers implement bit shifting efficiently in GX Works3 ladder logic.
SFR and SFL Instructions in Mitsubishi PLC
The SFR (Shift Right) and SFL (Shift Left) instructions are designed to shift the contents of a 16-bit word within the PLC. For example, when using a register like D10, you can shift its bit pattern to the left or right depending on the instruction.
- SFR (Shift Right): Shifts the bits of a 16-bit register one or more positions to the right. The least significant bit (LSB) is discarded, and the most significant bit (MSB) is filled with 0.
- SFL (Shift Left): Shifts the bits to the left. The MSB is discarded, and a 0 is inserted into the LSB.
✅ GX Works3 Ladder Logic Example:
LD M0 // If M0 turns ON, execute shift right
SFR D10 K1 // Shift D10 right by 1 bit
LD M1 // If M1 turns ON, execute shift left
SFL D10 K1 // Shift D10 left by 1 bit
Each time the instruction executes, the register’s contents shift by one position.
Practical Example of SFR and SFL
Imagine register D10 initially contains:
1000001000000000
- After one SFR execution (shift right by 1 bit):
0100000100000000
- After several shifts (M0 ON multiple times):
0001000001000000
0000100000100000
0000010000010000
- After one SFL execution (shift left by 1 bit, M1 ON):
0000100000100000
This demonstrates how Mitsubishi PLC shift registers are ideal for tracking product positions on conveyors and controlling sequential steps in automation projects.
BSFR and BSFL – Bit-Level Shifting
In addition to full word shifts, Mitsubishi PLCs offer bit-level shift instructions:
- BSFR (Bit Shift Right): Shifts individual bits within a bit array to the right.
- BSFL (Bit Shift Left): Shifts bits in the array to the left.
These are especially useful in precision control applications, such as:
- Sorting defective products in packaging lines.
- Running LED light patterns in industrial displays.
- Controlling machine cycles at a bit-level resolution.
Why Shift Registers Matter in Mitsubishi PLC Programming
Shift registers are widely used in Mitsubishi PLC automation projects for:
- Conveyor tracking systems (bottle filling, labeling, packaging).
- PLC to PLC communication in distributed control systems.
- Modbus TCP communication where bit alignment is critical.
- Industrial machinery control where sequential steps need monitoring.