Bit Right Shift - Mitsubishi Electric MELSEC Q Series Programming Manual

Structured text
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

6 IEC FUNCTIONS

6.6.2 Bit right shift

The specified data is shifted n bits to the right.
Function definition
Function definition
6 - 40
SHR
SHR_E
ANY_BIT SHR ( ANY_BIT S1, ANY_BIT n );
Argument
Argument Name
IN/OUT
S1
IN
n
IN
Return value
Return Value
ANY_BIT
Shifted data
Remarks: n bits of data from the most significant bit are 0.
Remarks:
Example of use
Argument Type
INT
D0 := SHR( D1,1 );
BOOL SHR_E( BOOL EN, ANY_BIT S1, ANY_BIT n, ANY_BIT D1 );
Argument
Argument Name
IN/OUT
EN
IN
S1
IN
n
IN
D1
OUT
Return value
Return Value
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);
Data to be shifted
Number of bits to be shifted
Remarks: Only a constant can be specified as the number of bits to be
shifted.
ST Program
Conversion Result
LD
MOV
SFR
Execution condition (Function is executed only when the result is TRUE)
Data to be shifted
Number of bits to be shifted
Remarks: Only a constant can be specified as the number of bits to be
shifted.
Shifted data
Remarks: n bits of data from the most significant bit are 0.
For the usable data type, refer to "3.2.2 About ANY type".
Description
Description
Used Instruction
SM400
LD,MOV,SFR
D1 D0
D0 K1
Description
Description
*)
*)
6 - 40

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents