7 – 136 HEIDENHAIN Technical Manual TNC 426, TNC 430
7.7.56 SHIFT RIGHT (>>)
Syntax: >> (SHIFT RIGHT)
Operands: B, W, D, K
Action:
A SHIFT RIGHT instruction divides the content of the word accumulator by
two. This is done by simply shifting the bits by one place to the right. You
define the number of shifts through the operand. The bits that the TNC shifts
to the right out of the accumulator are then lost. The TNC extends the left side
of the accumulator with the correct sign.
This instruction is one of the arithmetic commands because it includes the
sign bit. For this reason, and to save time, you should not use this command
to isolate bits.
Example:
Shift the content of double word D8 four times to the right, then assign it to
double word 12.
Initial state:
Double word D8 = 3E 80 (hex)
Double word D12 = ?
The accumulator content is shown here in binary notation; the operand
content in hexadecimal notation.
Instead of using the >> K+1 command four times, simply use the >> K+4
command.
Function STL Accumulator contents [bit] Operand
content (hex)
x xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
Load the double
word D8 into the
word
accumulator.
L D8 0 0000000 00000000 00111110 10000000 0 0 00 3E 80
Shift the content
of the word
accumulator to
the right by the
number of bits
that are specified
in the operand.
>>
K+1
0 0000000 00000000 00011111 01000000
>>
K+1
0 0000000 00000000 00001111 10100000
>>
K+1
0 0000000 00000000 00000111 11010000
>>
K+1
0 0000000 00000000 00000011 11101000
Assign the result
to double word
D12.
= D12 0 0000000 00000000 00000011 11101000 0 0 00 03 E8