Mitsubishi Electronics Q173CPU(N) ユーザーズマニュアル

ページ / 472
 
 
 
7 - 22 
7   OPERATION CONTROL PROGRAMS  
 
F/FS G 
 
 
7.5.5 Bit right shift : >>  
Format 
(S1) >> (S2) 
 
Number of basic steps 
 
[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 right-shifted 
(S2) 
Number of right shifts 
Data type of (S1)  
(Integer type)  
 
[Functions] 
(1)   The data specified with (S1) is shifted to the right by the number of times specified 
with (S2).  
 
(2)   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.  
 
(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 two bit positions to the right and substitutes the result to 
D0  
 
D0 = #0 >> K2  
 
#0
D0
0 0 1 0 0 1 0 1 0 0 1 1 0 1 0 0
b0
b15
0 0 0 0 1 0 0 1 0 1 0 0 1 1 0 1
b0
b15