Rotating Data To The Left By N Bit(S) - Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

28.3

Rotating Data to the Left by n Bit(s)

ROL(_E)
RnPCPU
RnPCPU
RnCPU RnENCPU
(Process)
(Redundant)
These functions rotate the input value to the left by (n) bit(s), and output the operation result.
Ladder, FBD/LD
[Without EN/ENO]
s
d
n
Setting data
■Description, type, data type
Argument
Description
EN
Execution condition (TRUE: Executed, FALSE: Not executed)
s (IN)
Input
n (N)
Number of bits to be shifted
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
d
Output
Processing details
■Operation processing
• These functions rotate the WORD or DWORD data type value input to (s) to the left 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 rotated in (n).
WORD, DWORD
Ex.
Data type of (s): WORD, Value input to (n): 3 (The data rotates to the left by 3 bits.)
(s)
270FH
WORD
0
0
1
0
0
270FH
0
0
1
1
1
3879H
• 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.
Data type of (s): WORD
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
RnSFCPU RnSFCPU
(Standard)
(Safety)
[With EN/ENO]
EN
ENO
s
d
n
Left rotation by (n) bits
1
1
1
0
0
0
0
0
0
0
0
1
1
1
Structured text
[Without EN/ENO]
d:=ROL(s,n);
[With EN/ENO]
d:=ROL_E(EN,ENO,s,n);
Type
Input variable
Input variable
Input variable
Output variable
Output variable
(d)
3879H
WORD
1
1
1
1
1
0
0
1
Data type of (s): DWORD
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
28.3 Rotating Data to the Left by n Bit(s)
Data type
BOOL
ANY_BIT
ANY_BIT
BOOL
ANY_BIT
28 BIT SHIFT FUNCTIONS
1923
28

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents