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 DWORD data registers.
This is the value to rotate to the right.
The result of the rotation 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 DWORD data registers or constants.
This is the number of bits to rotate.

The value range is 0 ~ 31.
The remainder n ÷ 16 will be the result of n if the value of n is greater than 15.

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 rotation exceeds the data register assigned to 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 DRCR and DRCRP instructions behave as follows:

  • The value in the data register, D, is rotated to the right.
    • The value is rotated from the most significant bit to the least significant bit.
  • The least significant bit rotates to the carry flag, F11.2.
  • The most significant bit rotates in a range of D‘s DWORD value.
  • The carry flag turns ON when 1 is rotated into the carry flag, F11.2.
  • When the instruction energizes, data stored in the carry flag, F11.2, is included in the rotation.
    • IMG images/01-drcr-notice-example-b.webp – n should be a value from 0 ~ 31. Notice
  • n should be a value from 0 ~ 31.
    • If n is greater than 31, the remainder from n ÷ 32 is the equivalent.
      • Example: if n = 34, the remainder is 2.
        • This is the same as n = 2.

Ladder Diagram Examples

DRCR

The DRCR instruction will rotate the DWORD value, D, n number of bits to the right. The result of the rotation is saved in the same assigned DWORD dat

The DRCR instruction will rotate the DWORD value, D, n number of bits to the right. The result of the rotation is saved in the same assigned DWORD data register, D. The carry flag, F11.2, can be used.

The initial value of the DWORD data register, D30, is 23,204,308.

The initial value of the DWORD data register, D30, is 23,204,308.

When the contact, M6.0, is powered ON (1), the DWORD data register, D30, rotates 2 bits to the right.

When the contact, M6.0, is powered ON (1), the DWORD data register, D30, rotates 2 bits to the right.

The value of the DWORD data register, D30, changes from 23,204,308 to 5,801,077.

The value of the DWORD data register, D30, changes from 23,204,308 to 5,801,077.

After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.

After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.

When the instruction is reenergized, the value of the DWORD data register, D30, changes from 5,801,077 to -2,146,033,379.

When the instruction is reenergized, the value of the DWORD data register, D30, changes from 5,801,077 to -2,146,033,379.

After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.

After rotation, no overflow occurred. The value of the carry flag bit, F11.2, is 0.

DRCRP

The DRCRP one-shot instruction will rotate the DWORD value, D, n number of bits to the right. The result of the rotation is saved in the same assigned

The DRCRP one-shot instruction will rotate the DWORD value, D, n number of bits to the right. The result of the rotation is saved in the same assigned DWORD data register, 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 DWORD data register, D40, is 1,331,818,798.

The initial value of the DWORD data register, D40, is 1,331,818,798.

When the contact, M7.0, is powered ON (1), the DWORD data register, D40, rotates 3 bits to the right.

When the contact, M7.0, is powered ON (1), the DWORD data register, D40, rotates 3 bits to the right.

The value of the DWORD data register, D40, changes from 1,331,818,798 to -1,981,006,299.

The value of the DWORD data register, D40, changes from 1,331,818,798 to -1,981,006,299.

*After rotation, overflow occurred.

After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1, which is part of the data from the WORD data register, D40.

When the instruction is reenergized, the value of the DWORD data register, D40, changes from -1,981,006,299 to 1,899,857,860.

When the instruction is reenergized, the value of the DWORD data register, D40, changes from -1,981,006,299 to 1,899,857,860.

*After rotation, overflow occurred.

After rotation, overflow occurred. The value of the carry flag bit, F11.2, is 1, which is part of the data from the DWORD data register, D40.