5.4 Standard Bit Shift Functions
150
FXCPU Structured Programming Manual
(Application Functions)
5.4 Standard Bit Shift Functions
5.4.1 SHL(_E)
Outline
This function shifts data of specified bit length leftward by the specified number of bits.
1. Format
*1. Output variable
2. Set data
In explanation of functions, I/O variables inside ( ) are described.
Explanation of function and operation
1) This function shifts word [unsigned]/bit string [16-bit]/double word [unsigned]/bit string [32-bit] data stored
in a device specified in leftward by "n" bits, and outputs the obtained data to a device specified in
using the data type of data stored in a device specified in .
Data is shifted leftward by "n" bits specified in .
Example: When word [unsigned]/bit string [16-bit] data is stored in a device specified in , and "8" is
specified in
2) "n" bits from the least significant bit become "0".
FX3U(C) FX3G FX2N(C) FX1N(C) FX1S
FX
U
/FX
2C
FX0N FX0(S)
Function name
Expression in each language
Structured ladder ST
SHL
SHL(_IN,_N);
Example:
D10:=
SHL(D0,K1);
SHL_E
SHL_E(EN,_IN,_N,Output label);
Example:
SHL_E(X000,D0,K1,D10);
Variable Description Data type
Input
variable
EN Execution condition Bit
_IN ( )
Word device which stores data to be shifted leftward ANY_BIT
_N ( )
Number of shifted bits ANY_BIT
Output
variable
ENO Execution status Bit
*1 ( )
Word device which will store data obtained by shift ANY_BIT
SHL
*1
D10D0 _IN
_NK1
SHL_E
EN ENO
*1
D10
X000
D0
_IN
_NK1
s
n
d
s
d s
n
s
n
270FH F00H
270FH 0 0 1 0 0 1 1 1 0 0 0 0 1 1 1 1
0000111100000000
F00H
These bits become "0".
ds
(Word [unsigned]/
bit string [16-bit] data)
(Word [unsigned]/
bit string [16-bit] data)