Load two's complement (l–), 3 load two's complement (l–) l – HEIDENHAIN TNC 306 Technical Manual User Manual
Page 320
7-30
TNC 416/TNC 406/TNC 306
Commands
3/2000
3.1.3 LOAD TWO'S COMPLEMENT (L–)
L–
Abbreviation for the PLC-Editor:
L– (LOAD MINUS)
Logic
Byte/Word
Double
Constant
Execution time [µs]
----
2.4/2.0
2.2
1.8
Number of bytes
----
8
6
8
Operands: B, W, D, K
Operation:
The contents of the addressed Operand (B, W, D) or a Constant (K) are loaded into the Word
Accumulator as a two's complement. In addition, the Accumulator is filled, if necessary, according to
the sign bit. The two's complement allows negative numbers to be stored. i.e. a number loaded with
the L– command appears in the Accumulator with an inverted sign.
This command may only be used with Word execution.
Example:
The contents of Byte B5 is to be negated, added to Byte B6 and the result assigned to Byte B8.
Initial state:
Byte B5 = 15 (dec)
Byte B6 = 20 (dec)
Byte B8 = ?
Line Instruction
Accumulator contents
Operand contents
Bit
31 . . . 15
7
0
7 0
... x x x x x x x x x x x x x x x x x x
1
L– B5
... 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 (–15)
(+15) 00001111
2
+ B6
... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 (+ 5)
(+20) 00010100
3
= B8
... 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 (+ 5)
(+5) 00000101
To aid understanding of this example, the contents of the Accumulator and operands are shown as
decimal values in parentheses.
Line 1:
The contents of Byte B5 are loaded into the Accumulator and the sign of the value is
inverted.
Line 2:
The contents of the Word Accumulator and Byte B6 are added.
Line 3:
The result is assigned to Byte B8.