06.08.2013 Views

Technical Manual TNC 360 - heidenhain - DR. JOHANNES ...

Technical Manual TNC 360 - heidenhain - DR. JOHANNES ...

Technical Manual TNC 360 - heidenhain - DR. JOHANNES ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

3.9.2 SHIFT RIGHT (>>) >><br />

Abbreviation for PLC Editor: >> (SHIFT RIGHT)<br />

Byte/Word/Double Constant<br />

Execution time [µs] 2.0 + 0.2 x n 2.0 + 0.2 x n<br />

Number of bytes 6 8<br />

Operands: B, W, D, K<br />

Operation:<br />

Since the sign bit (MSB) is included with this command, it is grouped in with arithmetic commands.<br />

For this reason and out of time considerations, this command should not be used for the isolation of bits.<br />

A SHIFT RIGHT instruction causes the contents of the Word Accumulator to be divided by two. For this<br />

purpose, the bits in the Accumulator are simply shifted by one place to the right. The number of the shift<br />

operations is determined via the operand. Thus the set bits, which are shifted beyond the Accumulator to<br />

the right, are lost; the Accumulator is filled according to the sign, from the left-hand side. With operand<br />

contents greater than 32, the operand value Modulo 32 is used, i.e. the integer remainder from the division<br />

(operand value)/32.<br />

Example:<br />

The content of the Doubleword D8 is to be shifted four times to the right and then stored in D12.<br />

Initial state: Doubleword D8 = 3E 80 (hex)<br />

Doubleword D12 = ?<br />

The Accumulator content is shown here in binary notation and the operand content in hexadecimal<br />

notation.<br />

Line Instruction Accumulator Content Operand<br />

Content<br />

xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx<br />

1 L D8 00000000 00000000 00111110 10000000 00 00 3E 80<br />

2 >> K1 00000000 00000000 00011111 01000000<br />

3 >> K1 00000000 00000000 00001111 10100000<br />

4 >> K1 00000000 00000000 00000111 11010000<br />

5 >> K1 00000000 00000000 00000011 11101000<br />

6 = D12 00000000 00000000 00000011 11101000 00 00 03 E8<br />

Line 1: Load Doubleword D8 into the Accumulator.<br />

Line 2 to 5: The content of the Word Accumulator is shifted to the right by the number of bits<br />

specified in the operand. The complete operation can also be undertaken with the<br />

command >> K+4.<br />

Line 6: The result is stored in Doubleword D12.<br />

8/95 <strong>TNC</strong> <strong>360</strong> 3 Commands 7-83

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!