July 2013 9.8 Command Set 1807
9.8.55 SHIFT RIGHT (>>)
Syntax: >> (SHIFT RIGHT)
Operands: B, W, D, K
Action:
A SHIFT RIGHT statement 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 iTNC shifts
to the right out of the accumulator are then lost. The iTNC extends the left side
of the accumulator with the correct sign.
This statement 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 = ?
Instead of using the >> K+1 command four times, simply use the >> K+4
command.
Function STL Accumulator
content
Operand content
Load the double word D8
into the word accumulator
L D8 3E80 3E80
Shift the content of the
word accumulator to the
right by the number of
bits that are specified in
the operand.
>> K+1 1F40
>> K+1 FA0
>> K+1 7D0
>> K+1 3E8
Assign the result to
double word D12.
= D12 3E8 3E8