5 - 24
5 OPERATION CONTROL PROGRAMS
F/FS G
5.5.5 Bit right shift : >>
Format (S1) >> (S2) Number of basic steps 4
[Usable data]
Setting
data
Usable Data
Bit device
Word device Constant
Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
16-bit
integer
type
32-bit
integer
type (L)
64-bit
floating
point
type (F)
Coasting
timer
16-bit
integer
type (K/H)
32-bit
integer type
(K/H, L)
64-bit
floating
point
type (K)
(S1) —
—
—
— —
(S2) —
—
—
— —
: Usable
[Setting data]
Setting data Description Data type of result
(S1) Data to be right-shifted Data type of (S1)
(Integer type)
(S2) Number of right shifts
[Functions]
(1) The data specified with (S1) is shifted to the right by the number of times specified
with (S2).
(2) If the most significant bit of (S1) is 1, 1 enters the most significant bit of the right
shift result.
If the most significant bit of (S1) is 0, 0 enters the most significant bit of the right
shift result.
(3) When (S1) is a 16-bit integer type and (S2) is a negative number or not less than
16, the result is 0.
(4) When (S1) is a 32-bit integer type and (S2) is a negative number or not less than
32, the result is 0.
[Errors]
(1) An operation error will occur if:
• (S1) or (S2) is an indirectly specified device and its device No. is outside the
range.
[Program examples]
(1) Program which shifts #0 two bit positions to the right and substitutes the result to
D0
D0 = #0 >> K2
#0
D0
0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0
b0b15
0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 1
b0b15