Bit Left Shift - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Bit left shift: <<
Format
(S1) << (S2)
Setting data
■Usable data
: Usable
Setting
Usable Data
data
Bit
Word device
device
16-bit
integer
type
(S1)
(S2)
■Description, data type of result
Setting data
Description
(S1)
Data to be left-shifted
(S2)
Number of left shifts
Processing details
• 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.
Operation error
An operation error will occur if:
• (S1) or (S2) is an indirectly specified device and its device No. is outside the range.
Program example
■Program which shifts #0 one bit position to the left and substitutes the result to D0
D0 = #0 << K1
b15
D0
0
1 0 0 1 0 1 0 0 1 1 0 1 0 0 0
Number of basic steps
7
Constant
32-bit
64-bit
16-bit
integer
floating
integer
type (L)
point
type
type (F)
(K/H)
b0
b15
#0
0
0 0 0 0 0 0
1
Usable steps
F/FS
Calculation
expression
32-bit
64-bit
integer
floating
type
point
(K/H, L)
type (K)
b0
1 1
1 1 1
0 0 0
4 OPERATION CONTROL PROGRAMS
G
Bit
Comparison
conditional
conditional
expression
expression
Data type of result
Data type of (S1) (Integer type)
4.6 Bit Operations
4
143

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents