Download Print this page

Chapter 21 Bit Shift Functions - Mitsubishi Electric MELSEC iQ-F FX5 Programming Manual

Instructions, standard functions/function blocks
Hide thumbs Also See for MELSEC iQ-F FX5:

Advertisement

21
BIT SHIFT FUNCTIONS
21.1
n-bit Left Shift
SHL(_E)
These functions shift an input value leftward by (n) bits and output the result.
Ladder diagram, FBD/LD
[Without EN/ENO]
s
d
n
Setting data
■Descriptions, types, and data types
Argument
Description
EN
Execution condition (TRUE: Execution, FALSE: Stop)
s(IN)
Input
n(N)
Number of shift bits
ENO
Output status (TRUE: Normal, FALSE: Abnormal)
d(SHL(_E))
Output
Processing details
■Operation processing
• These functions shift the 16-bit or 32-bit data (WORD or DWORD type) 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-shift bits.
Ex.
When the data type of (s) is 16-bit data (WORD) and 8 is input in (n)
270FH
IN (WORD)
0
0
1
0
0
1
1
270FH
0
0
0
0
1
1
1
F00H
• "0" is set to "n" bits from the least significant bit.
• The input data to (s) is 16-bit data/32-bit data (WORD or DWORD type).
• A value input to (n) (Number of shift bits) is the INT type data value and within the following range.
When the data of (s) is 16-bit data (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
F00H
WORD
1
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
Structured text
[Without EN/ENO]
d:=SHL(s,n);
[With EN/ENO]
d:=SHL_E(EN,ENO,s,n);
Type
Input variable
Input variable
Input variable
Output variable
Output variable
When the data of (s) is 32-bit data (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
21 BIT SHIFT FUNCTIONS
1001
21.1 n-bit Left Shift
21

Hide quick links:

Advertisement

loading