Bit-shift instructions
600
Part III FP Instructions
F128_DRCL
32-bit data right rotate with carry flag data
The bit value at bit position 32 - n is stored in the carry flag. The function shifts out n bits to the left
via bit 31 (MSB), and then along with the inverted carry flag first, continues via bit 0 (LSB) into the
storage range. Position n - 1 now has the inverted value of the carry flag.
When input n = 0, no rotation occurs and the carry flag remains unchanged.
When at input n > 32, the same result is achieved as with a number n < 32: e.g. n = 33 produces
the same result as when n = 0; n = 34 the same as n = 1.
1 0 1 1 1 0 0 1 0 1 1
31 0
1 1 0 0 1 1 0 1
28 27 24 23 4 3
· · ·
1 0 1 1
0
@
1
@
0
start: ON
data
data
Carry
flag
Carry flag
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
PLC types
Availability of F128_DRCL (see page 1321)
Variable Data type Function
d ANY32 32-bit area
n INT number of bits to be rotated (range: 0 to 255)
For Relay T/C Register Constant
d - DWY DWR DWL DSV DEV DDT DLD DFL -
n WX WY WR WL SV EV DT LD FL dec. or hex.
No. IEC address Set If
R9009 %MX0.900.9 for an instant the bit at position 32 - n has the value 1.
Description
The function rotates the value at output d via the carry flag to the left. The number of bits at output
d to be rotated to the left is specified by the value assigned at input n. This shift can lie between 0
and 255 (only the lower value byte of n is effective).
Data types
Operands
Error flags
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.