28 BIT SHIFT FUNCTIONS
28.2 Shifting Data to the Right by n Bit(s)
1921
28
28.2
Shifting Data to the Right by n Bit(s)
SHR(_E)
These functions shift the input value to the right by (n) bit(s), and output the operation result.
Setting data
■
Description, type, data type
Processing details
■
Operation processing
• These functions shift the WORD or DWORD data type value input to (s) to the right by (n) bit(s), and output the operation
result, in the same data type as (s), from (d).
• Specify the number of bits to be shifted in (n).
Ex.
Data type of (s): WORD, Value input to (n): 8
• The (n) bit(s) from the most significant bit is/are filled with 0(s).
• Input a WORD or DWORD data type value to (s).
• Input an INT data type value to (n) (Number of bits to be shifted) within the following range.
Ladder, FBD/LD
Structured text
[Without EN/ENO]
[With EN/ENO]
[Without EN/ENO]
d:=SHR(s,n);
[With EN/ENO]
d:=SHR_E(EN,ENO,s,n);
Argument
Description
Type
Data type
EN
Execution condition (TRUE: Executed, FALSE: Not executed)
Input variable
BOOL
s (IN)
Input
Input variable
ANY_BIT
n (N)
Number of bits to be shifted
Input variable
ANY_BIT
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
Output variable
BOOL
d
Output
Output variable
ANY_BIT
Data type of (s): WORD
Data type of (s): DWORD
Range: 0 to 15
The lower 4-bit data is used.
[Example]
If the input value is 6: 6
If the input value is 22: 6
Range: 0 to 31
The lower 5-bit data is used.
[Example]
If the input value is 6: 6
If the input value is 22: 22
RnCPU RnENCPU
RnSFCPU RnSFCPU
RnPCPU
RnPCPU
(Standard)
(Safety)
(Redundant)
(Process)
s
d
n
EN
ENO
s
d
n
(s)
(d)
27H
0
0
1
0
0
1
1
1
0
0
0
0
1
1
1
1
270FH
27H
270FH
0
0
1
0
0
1
1
1
0
0
0
0
0
0
0
0
WORD
0
WORD
Summary of Contents for MELSEC iQ-R Series
Page 1: ...MELSEC iQ R Programming Manual Instructions Standard Functions Function Blocks ...
Page 2: ......
Page 24: ...22 INDEX 2092 INSTRUCTION INDEX 2093 REVISIONS 2104 WARRANTY 2105 TRADEMARKS 2106 ...
Page 34: ...32 MEMO ...
Page 35: ...33 PART 1 PART 1 OVERVIEW This part consists of the following chapter 1 OVERVIEW ...
Page 68: ...66 1 OVERVIEW 1 5 Precautions on Programming MEMO ...
Page 1448: ...1446 14 REDUNDANT SYSTEM INSTRUCTIONS 14 2 Disabling Enabling System Switching MEMO ...
Page 1972: ...1970 33 TIME DATA TYPE FUNCTIONS 33 4 Division MEMO ...
Page 2067: ...APPX Appendix 5 PID Control Program Examples 2065 A 252 Set PID control data for loop 2 ...
Page 2109: ......