7 - 23
7 OPERATION CONTROL PROGRAMS
F/FS G
7.5.6 Bit left shift : <<
Format (S1) << (S2) Number of basic steps 4
[Usable data]
Usable Data
Word device Constant
Setting
data
Bit device
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)
Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
(S1) —
—
—
— —
(S2) —
—
—
— —
: Usable
[Setting data]
Setting data Description Data type of result
(S1) Data to be left-shifted
(S2) Number of left shifts
Data type of (S1)
(Integer type)
[Functions]
(1) The data specified with (S1) is shifted to the left by the number of times specified
with (S2).
(2) 0 enters the least significant bit of the left 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 one bit position to the left and substitutes the result to D0
D0 = #0 << K1
#0
D0
0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0
b0b15
0 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0
b0b15