beautypg.com

Shift commands, 7 shift commands – HEIDENHAIN TNC 122 Technical Manual User Manual

Page 57

background image


56

TNC 122

12 PLC Description

4/97

Parentheses with comparison commands

The execution sequence in an instruction list can be altered by using parentheses. The open-
parentheses command loads the contents of the Word Accumulator onto the Program Stack. The
Accumulator is now available for the calculation of intermediate results.

The "close-parentheses" instruction initiates the gating of the buffered value from the Program Stack
with the content of the complete Word Accumulator. The result is again loaded into the
Accumulator. The maximum nesting depth is 16 parentheses.

A direct transition from Word to Logic execution takes place with comparison commands. If the
comparison condition is true, the Logic Accumulator is set to 1. If the condition is not true, the Logic
Accumulator is set to 0.

EQUAL TO [ ]

(==[ ])

LESS THAN [ ]

(<[ ])

GREATER THAN [ ]

(>[ ])

LESS THAN OR EQUAL TO [ ]

(<=[ ])

GREATER THAN OR EQUAL TO [ ]

(>=[ ])

UNEQUAL [ ]

(<>[ ])

12.2.7 Shift Commands

SHIFT LEFT (<<)

Operands: B, W, D, K
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 one place to the left. The result
must be within the range of –2 147 483 648 to +2 147 483 647, otherwise the Accumulator will
contain an undefined value. The number of shift operations is determined by the operand; the right
side of the Accumulator is filled with zeros.

SHIFT RIGHT (>>)

Operands: B, W, D, K
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 RIGHT instruction causes the contents of the Word Accumulator to be divided by
two. For this purpose the bits in the Accumulator are simply shifted one place to the right. The
number of shift operations is determined by the operand. The set bits, which are shifted beyond
the Accumulator to the right, are lost; the Accumulator is filled from the left-hand side including
the sign.