beautypg.com

9 shift commands, 1 shift left (<<), 9 shift commands 3.9.1 shift left (<<) – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual

Page 554

background image


01.98

TNC 407/TNC 415/TNC 425

3 Commands

7-93

3.9 Shift Commands

3.9.1 SHIFT LEFT (<<)

Abbreviation for PLC Editor:

<< (SHIFT LEFT)

Byte/Word/Double

Constant

Execution time [µs]

0.7 to 1.0

0.5 to 0.6

Number of bytes

6

8

Operands: B, W, D, K

Operation:
Since the sign bit (MSB) is included with this command, it is grouped in with arithmetic commands.
For this reason and out of time considerations, this command should not be used for the isolation of bits.
A SHIFT LEFT instruction causes the contents of the Word Accumulator to be multiplied by two. For this
purpose, the bits in the Accumulator are simply shifted by one place to the left. The result must lie in the
range of –2

147

483

648 to +2

147

483

647, otherwise the Accumulator contains an undefined value.

The number of shift events is defined by the operand. The Accumulator is filled on the right side
with nulls.

Initial state:

Doubleword D8 = 3E 80 (hex)
Doubleword D12 = ?

The Accumulator content is shown here in binary notation, and the operand content in hexadecimal
notation.

Line Instruction

Accumulator Content

Operand Content

xxxxxxxx

xxxxxxxx

xxxxxxxxx

xxxxxxxxx

1

L D8

00000000

00000000 00111110

10000000

00

00

3E

80

2

<< K+1

00000000

00000000 01111101

00000000

3

<< K+1

00000000

00000000 11111010

00000000

4

<< K+1

00000000

00000001 11110100

00000000

5

<< K+1

00000000

00000011 11101000

00000000

6

= D12

00000000

00000011 11101000

00000000

00

03

E8

00

Line 1:

Load Doubleword D8 into the Accumulator.

Line 2 to 5:

The content of the Word Accumulator is shifted to the left by the number of bits
specified in the operand. The complete operation can also be undertaken with the
command << K+4.

Line 6:

The result is stored in the Doubleword D12.