Function - Shift bits of a register to the right.

Inputs

Input

Data type

Description

IN

ANY

Register.

NBS

ANY

Number of shifts (each shift is 1 bit).

Outputs

Output

Data type

Description

Q

ANY

Shifted register.

IMPORTANT!

If the option "SHR: do not duplicate the most significant bit" is checked in the "Project settings / Advanced" box, then the most significant bit is set to FALSE.

If the option is not checked, then the most significant bit is duplicated:

Fixed_Image

Remarks

Arguments can be signed or unsigned integers from 8 to 32 bits.

In LD language, the input rung (EN) enables the operation, and the output rung keeps the state of the input rung.

ST Language

Q := SHR (IN, NBS);

FBD Language

Fixed_Image

LD Language

The shift is executed only if EN is TRUE.
ENO has the same value as EN.

Fixed_Image

Fixed_Image See also

SHL  ROL  ROR  SHLb  SHRb  ROLb  SHLw  SHRw  ROLw


Created with the Personal Edition of HelpNDoc: Make Documentation a Breeze with HelpNDoc's Clean and Efficient User Interface