Bit Right Shift - Mitsubishi Electric R16MTCPU Programming Manual

Hide thumbs Also See for R16MTCPU:
Table of Contents

Advertisement

Bit right shift: >>
Format
(S1) >> (S2)
Setting data
■Usable data
: Usable
Setting
Usable Data
data
Bit
device
(S1)
(S2)
■Description, data type of result
Setting data
(S1)
(S2)
Processing details
• 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.
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 two bit positions to the right and substitutes the result to D0
D0 = #0 >> K2
b15
D0
0
0 0 0 1 0 0 1 0 1 0 0 1 1 0 1
4 OPERATION CONTROL PROGRAMS
142
4.6 Bit Operations
Number of basic steps
7
Word device
16-bit
32-bit
64-bit
integer
integer
floating
type
type (L)
point
type (F)
Description
Data to be right-shifted
Number of right shifts
b0
Usable steps
F/FS
Constant
16-bit
32-bit
64-bit
integer
integer
floating
type
type
point
(K/H)
(K/H, L)
type (K)
b15
b0
#0
0
0 0 0 0 0 0
1
1 1
1 1 1
0 0 0
G
Calculation
Bit
expression
conditional
expression
Data type of result
Data type of (S1) (Integer type)
Comparison
conditional
expression

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R64mtcpuMelsec iq-r seriesR32mtcpu

Table of Contents