Bit-shift instructions
558
Part III FP Instructions
F100_SHR
Right shift of 16-bit data in bit units
00
·· ·· ·· ··
d
15 1211 8 7 4 3 0
·· ·· ·· ··
d
15
0
12
0
11 87 43 0
n
2
1
Bit position
Bit position
When n bits are shifted to the right, the data in the nth bit
1
is transferred to special internal relay
R9009 (carry-flag) and the higher n bits of the 16-bit data area
2
specified by d are filled with 0s.
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 F100_SHR (see page 1320)
Variable Data type Function
d ANY16 16-bit area to be shifted to the right
n INT number of bits to be shifted
For Relay T/C Register Constant
d - WY WR WL SV EV DT LD FL -
n WX WY WR WL SV EV DT LD FL dec. or hex.
Description
Shifts n bits of 16-bit data area specified by d to the right (to the lower bit position) if the trigger EN
is in the ON-state.
Data types
Operands
Example
In this example the function has been programmed in ladder diagram (LD) and structured text
(ST).The same POU header is used for all programming languages.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start changes from FALSE to TRUE, the function is carried out.