N-Bit Left Rotation - Mitsubishi MELSEC iQ-F FX5 series Programming Manual

Melsec iq-f fx5 series
Hide thumbs Also See for MELSEC iQ-F FX5 series:
Table of Contents

Advertisement

18.3

n-bit Left Rotation

ROL(_E)
These functions rotate an input value leftward by (n) bits and output the result.
Ladder diagram
[Without EN/ENO]
s
d
n
Setting data
■Descriptions, types, and data types
Argument
Description
EN
Execution condition (TRUE: Execution, FALSE: Stop)
s
Input
n
Number of shift bits
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
d
Output
Processing details
■Operation processing
• These functions rotate the WORD or DWORD type data input to (s) left by (n) bits and output the result in the same data
type as (s) from (d).
• The number input in (n) is used as the number of left-rotation bits.
WORD, DWORD
Ex.
When the data type of (s) is WORD and 3 is input in (n) (The bits are rotated left by 3 bits.)
270FH
IN (WORD)
1)
0
0
1
0
0
1
1
270FH
0
0
1
1
1
0
0
3879H
Data of 2)
• A value input to (n) is the WORD or DWORD type data value.
• A value input to (n) (Number of shift bits) is the INT type data value and within the following range.
When the data type of (s) is WORD
A value in (n) is within 0 to 15.
The lower 4-bit data of the value in (n) is used.
[Example]
When the input value is 6: 6
When the input value is 22: 6
[With EN/ENO]
EN
ENO
s
d
n
n-bit rotation
3879H
WORD
2)
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
0
0
1
Data of 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
When the data type of (s) is DWORD
A value in (n) is within 0 to 31.
The lower 5-bit data of the value in (n) is used.
[Example]
When the input value is 6: 6
When the input value is 22: 22
Data type
BOOL
ANY_BIT
ANY_BIT
BOOL
ANY_BIT
18 BIT SHIFT FUNCTIONS
795
18.3 n-bit Left Rotation
18

Advertisement

Table of Contents
loading

Table of Contents