![SEW-Eurodrive IPOS plus Manual Download Page 306](http://html1.mh-extra.com/html/sew-eurodrive/ipos-plus/ipos-plus_manual_1250042306.webp)
306
Manual – IPOSplus®
23
Arithmetic commands
Assembler – Commands
SHR/SHIFT
RIGHT
The SHR command moves the content of a variable to the right by the number of bits
specified in a variable or constant. Zeros are moved along from the left.
ASHR/ARITHME-
TIC SHIFT RIGHT
The ASHR command shifts the content of a variable to the right by the number of bits
specified in a variable or constant. Either zeros or ones are shifted along from the left,
depending on the sign of the original value. This ensures that a negative sign is kept dur-
ing shift operations.
For positive numbers, the command supplies the predecimal number of the division X1/
X2. For negative numbers, the command supplies the predecimal number of the division
X1/X2 - 1.
Command structure
Mxxx SHR X1 >> X2
Mxxx: Label (optional)
X1: Variable (result and output value)
X2: Variable or constant (number of shift operations)
SHR HXX >> HYY
In variable HXX the bits are shifted HYY places to the right.
SHR HXX >> K
In variable HXX the bits are shifted K places to the right.
Example 1
SET H01 = 62SET H02 = 1SHR
H01 > > H02
[0b0000000000111110][0b000
0000000011111]
After the SHR command, H01 = 31.
Example 2
A certain binary significance is assigned to the input terminals of the basic
unit and the DIO11A option. To use inputs DI10 ... DI13 for table position-
ing in a useful manner (4 entries = 0 ... 15 positions), shift the significance
of the inputs so that the terminal with the lowest value DI10 receives the
significance 2
0
.
SET H01 = 960SET H02 =
6SHR H01 > > H02
[0b0000001111000000][0b000
0000000001111]
Command structure
Mxxx ASHR X1 >> X2
Mxxx: Label (optional)
X1: Variable (result and output value)
X2: Variable or constant (number of shift operations)
ASHR HXX >> HYY
In variable HXX the bits are shifted HYY places to the right.
ASHR HXX >> K
In variable HXX the bits are shifted K places to the right.
Example 1
SET H01 = 7ASHR H01 > > 2
[0b0000000000000111][0b000
0000000000001]
After the SHR command, H01 = 1.
Example 2
SET H01 = -7ASHR H01 > > 2
[0b1111111111111001][0b111
1111111111110]
After the ASHR command, H01 = -2.
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n