The leader in industrial automation and control solutions

Instruction Parameters

Supported PLC Series

PLC-AESPLC-FBPLC-ES

Supported Data Registers

MXYKLFTCSZRQD@DConstant
D
n

Supported Flags

FlagBitSupport
ErrorF11.0
ZeroF11.1
CarryF11.2

Number of Steps

Steps
3

Operands

OperandDescription
DThe first operand.
Entries are only BOOL data registers.
This is the n-bit of data to be shifted right.
The result of the shift is saved here.
nThe second operand.
Entries are WORD data registers or constants.
This is the number of bits to shift.

The value range is 1 ~ the last data register of D.

Notice

Error Flag (F11.0) Notice

The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type. F11.0 turns ON when the value of the data for a shift exceeds the data register assigned to D. F11.0 turns ON when the value of n is greater than the amount of data registers D.

Carry Flag (F11.2) Notice

The carry flag, F11.2, will be ON for one scan when the operation result overflows.

Instruction Behavior

The BSFL and BSFLP instructions behave as follows:

  • IMG images/01-bsfl-notice.webp – n-bit data is shifted to the left starting at the BOOL data register, D. Notice
  • n-bit data is shifted to the left starting at the BOOL data register, D.
    • Data is shifted 1 bit in the direction of the most significant bit.
  • The value of n CANNOT exceed the size of the data register D.
  • The data located in the data register D is shifted into the carry flag, F11.2.
  • The carry flag turns ON when 1 is shifted into the carry flag, F11.2.
  • The data register D + (n-1) is equal to 0.
    • This occurs when the instruction is energized.

Execution Condition

It is recommended that the BSFL instructions be used with a pulse contact as an execution condition, or use the BSFLP instruction.

Ladder Diagram Examples

BSFL

The BSFL instruction shifts n-bit data of the data register, D, 1 bit to the left starting at the bit, D.

The BSFL instruction shifts n-bit data of the data register, D, 1 bit to the left starting at the bit, D. The carry flag, F11.2, can be used.

The initial value of the WORD data register, D4, is 10,100.

The initial value of the WORD data register, D4, is 10,100. The initial value of the BOOL data register, D4.2 is 1.

When the contact, M2.0, is powered ON (1), the instructions shifts 5 bits of the WORD data register, D4, 1 bit to the left, starting at the BOOL data

When the contact, M2.0, is powered ON (1), the instructions shifts 5 bits of the WORD data register, D4, 1 bit to the left, starting at the BOOL data register, D4.2.

The value of the WORD data register, D4, changes from 10,100 to 10,088.

The value of the WORD data register, D4, changes from 10,100 to 10,088. The value of the BOOL data register, D4.2 changes from 1 to 0.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

When the instruction is reenergized, the bits are shifted 1 bit to the left again.

When the instruction is reenergized, the bits are shifted 1 bit to the left again.

The value of the WORD data register, D4, changes from 10,088 to 10,064.

The value of the WORD data register, D4, changes from 10,088 to 10,064. The value of the BOOL data register, D4.2 remains 0.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

The previous value stored in the carry flag bit, F11.2, is discarded.

The previous value stored in the carry flag bit, F11.2, is discarded.

BSFLP

The BSFLP one-shot instruction shifts n-bit data of the data register, D, 1 bit to the left starting at the bit, D.

The BSFLP one-shot instruction shifts n-bit data of the data register, D, 1 bit to the left starting at the bit, D. The carry flag, F11.2, can be used. Every time this instruction executes, it energizes the output only once.

The initial value of the WORD data register, D5, is 22,266.

The initial value of the WORD data register, D5, is 22,266. The initial value of the BOOL data register, D5.4 is 1.

When the contact, M2.1, is powered ON (1), the instructions shifts 4 bits of the WORD data register, D5, 1 bit to the left, starting at the BOOL data

When the contact, M2.1, is powered ON (1), the instructions shifts 4 bits of the WORD data register, D5, 1 bit to the left, starting at the BOOL data register, D5.4.

The value of the WORD data register, D5, changes from 22,266 to 22,250.

The value of the WORD data register, D5, changes from 22,266 to 22,250. The value of the BOOL data register, D5.4 changes from 1 to 0.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

The existing bits are shifted 1 bit to the left. The most significant bit is shifted into the carry flag bit, F11.2.

Ladder Diagram Example for MapleLogic BSFL/BSFLP instruction.