Skip to main content

Shift Right (DWORD)

Instruction Parameters

Supported PLC Series

XPnA/1RXPnBXPnEXPnFCP3A/B/P/U
CP4A~D/U
CPnECPnFBPPLC-S

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 DWORD data registers.
This is the value to shift to the right.
The result of the shift will be saved here.

The signed value range is -2,147,483,648 ~ 2,147,483,647 (232).
The unsigned value range is 0 ~ 4,294,967,295 (232-1).
The Hexadecimal value range is H00000000 ~ HFFFFFFFF.
nThe second operand.
Entries are WORD data registers or constants.
This is the number of words 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 DSFR and DSFRP instructions behave as follows:

  • The value in the data register D is shifted to the right.
    • The value is shifted in the direction of the least significant bit.
  • The value of n CANNOT exceed the size of the data register, D.
  • Starting from the most significant bit, data is shifted 1 WORD in the direction of the least significant data register.
  • The data register, D + (n -1), is equal to 0.
    • This occurs when the instruction is energized.
  • Data from D is lost after the instruction executes.
T and C Registers

With the T and C data registers, only the value of TC and CC can be shifted.

Execution Condition

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

Examples