6 - 40 6 - 40
6 IEC FUNCTIONS
6.6.2 Bit right shift SHR
SHR_E
The specified data is shifted n bits to the right.
Function definition
ANY_BIT SHR ( ANY_BIT S1, ANY_BIT n );
Argument
Argument Name
IN/OUT
Description
S1
IN
Data to be shifted
n
IN
Number of bits to be shifted
Remarks: Only a constant can be specified as the number of bits to be
shifted.
Return value
Return Value
Description
ANY_BIT Shifted
data
Remarks: n bits of data from the most significant bit are 0.
Remarks:
Example of use
Argument Type
ST Program
Conversion Result
Used Instruction
INT
D0 := SHR( D1,1 );
LD
SM400
MOV D1
D0
SFR D0
K1
LD,MOV,SFR
Function definition
BOOL SHR_E( BOOL EN, ANY_BIT S1, ANY_BIT n, ANY_BIT D1 );
Argument
Argument Name
IN/OUT
Description
EN
IN
Execution condition (Function is executed only when the result is TRUE)
S1
IN
Data to be shifted
n
IN
Number of bits to be shifted
Remarks: Only a constant can be specified as the number of bits to be
shifted.
D1 OUT
Shifted
data
Remarks: n bits of data from the most significant bit are 0.
Return value
Return Value
Description
BOOL Execution
condition
Example of use
(*
(*
When execution condition X0 turns ON, the data stored in D0 is shifted 2 bits
to the right, and the result is stored into Result.
M0:=SHR_E(X0, D0, 2, D100);
*)
*)
For the usable data type, refer to "3.2.2 About ANY type".
Содержание MELSEC L series
Страница 1: ...Programming Manual Structured Text ...
Страница 2: ......
Страница 73: ...4 33 4 33 4 ST PROGRAM EXPRESSIONS MEMO ...
Страница 297: ......