4 OPERATION CONTROL PROGRAMS
4.6 Bit Operations
143
4
Bit left shift: <<
■Usable data
: Usable
■Description, data type of result
• The data specified with (S1) is shifted to the left by the number of times specified with (S2).
• 0 enters the least significant bit of the left 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 one bit position to the left 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 left-shifted Data type of (S1) (Integer type)
(S2) Number of left shifts
D0 = #0 << K1
0#0 1 11 111
b15 b0
0D0 100101001101000
b15 b0
000000 000