142
4 OPERATION CONTROL PROGRAMS
4.6 Bit Operations
Bit right shift: >>
■Usable data
: Usable
■Description, data type of result
• The data specified with (S1) is shifted to the right by the number of times specified with (S2).
• 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.
• When (S1) is a 16-bit integer type and (S2) is a negative number or not less than 16, the result is 0.
• When (S1) is a 32-bit integer type and (S2) is a negative number or not less than 32, the result is 0.
An operation error will occur if:
• (S1) or (S2) is an indirectly specified device and its device No. is outside the range.
■Program which shifts #0 two bit positions to the right and substitutes the result to D0
Format Number of basic steps Usable steps
F/FS G
(S1) >> (S2) 7
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)
16-bit
integer
type
(K/H)
32-bit
integer
type
(K/H, L)
64-bit
floating
point
type (K)
(S1)
(S2)
Setting data Description Data type of result
(S1) Data to be right-shifted Data type of (S1) (Integer type)
(S2) Number of right shifts
D0 = #0 >> K2
0#0 111111
b15 b0
0D0 000100101001101
b15 b0
000000 000