beautypg.com

M3170, Modulo wrongly executed, 5 remainder (mod) – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual

Page 531

background image


7-70

TNC 407/TNC 415/TNC 425

3 Commands

01.98

3.4.5 REMAINDER (MOD)

Abbreviation for the PLC-Editor:

MOD (MODULO)

Logic

Byte/Word

Double

Constant

Execution time [µs]

----

6.6 to 8.0

6.6 to 7.3

6.3 to 7.8

Number of bytes

----

18

16

12

An error condition (Divisor = 0) results in an execution time of 1.0 to 1.8 µs.

Operands: B, W, D, K

Operation:
With arithmetic functions the operand is firstly expanded to the size of the Accumulator (32 bits).
Then the REMAINDER is determined from a division of the contents of the Word Accumulator by
the contents of the operand. The REMAINDER is stored in the Word Accumulator and may be
processed further. If the MOD command is not correctly executed then the Marker M3170 is set,
otherwise it is reset.

Example:
The REMAINDER of a division of the value stored in Word W6 by a constant is to be determined.
The REMAINDER is then stored in Doubleword D8.

Initial state:

Word

W6 = 50

(dec)

Constant

K

= 15

(dec)

Doubleword D8

= ?

In the interests of clarity the contents of the Accumulator and the operand are shown in decimal
notation. The 10 bit wide Accumulator allows the entry of the highest possible Accumulator
contents (2 147 483 647).

Line Instruction

Accumulator Contents

Operand Contents

x

x x x

x x x

x x x

1

L W6

5 0

2

MOD K15

5

5 0

3

= D8

5

5

Line 1:

The contents of Word W6 are loaded into the Accumulator.

Line 2:

The contents of the Accumulator are divided by the constant and the integer
REMAINDER is left in the Accumulator.

Line 3:

The REMAINDER is assigned to Doubleword D8.