5 MELSEC FUNCTIONS
5.12 Shift
5.12.1 n-bit right shift
The specified BIN 16-bit data are shifted n bits to the right.
Function definition
5.12.2 n-bit left shift
The specified BIN 16-bit data are shifted n bits to the left.
Function definition
5 - 53
SFR_M
BOOL SFR_M (BOOL EN, ANY16 n, ANY16 D);
Argument Name
EN
n
D
Return Value
BOOL
Execution condition
Example of use
(* When execution condition X0 turns ON, the data in D100 are shifted 4 bits
(* to the right.
SFR_M (X0, K4, D100);
Corresponding MELSEC command
SFR (n-bit right shift of 16-bit data)
SFL_M
BOOL SFL_M (BOOL EN, ANY16 n, ANY16 D);
Argument Name
EN
n
D
Return Value
BOOL
Execution condition
Example of use
(* When execution condition X0 turns ON, the data in D100 are shifted 4 bits
(* to the left.
SFL_M (X0, K4, D100);
Corresponding MELSEC command
SFL (n-bit left shift of 16-bit data)
IN/OUT
Execution condition (Function is executed only when
IN
the result is TRUE)
IN
Number of shifts (0 to 15) (BIN 16-bit data)
IN/OUT
Data to be shifted, shift result (BIN 16-bit data)
IN/OUT
Execution condition (Function is executed only when
IN
the result is TRUE)
IN
Number of shifts (0 to 15) (BIN 16-bit data)
IN/OUT
Data to be shifted, shift result (BIN 16-bit data)
For the usable data type, refer to "3.2.2
About ANY type".
Description
Description
Description
Description
*)
*)
*)
*)
5 - 53