beautypg.com

17 constants field (kf) 7-127, 18 program structures 7-127, 17 constants field (kf) – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual

Page 588: 18 program structures

background image


01.98

TNC 407/TNC 415/TNC 425

3 Commands

7-127

3.17 Constants Field (KF)

The Constants Field data type can be used to access one of several constants defined in tabular
form, depending on the value of the Index Register X.
Addressing is with KF Name[X], where 'Name' is a jump label that identifies the beginning of the
Constants Field.
Constants Fields start with the label KFIELD Name followed by a random (not zero) number of
constants followed by the end label ENDK. Constants Fields may only be created when the program
has been previously terminated with an EM or JP instruction.
The name of the Constants Fields conforms to the rules for jump labels.

Example:

L

KF VALUESFIELD

;ACCESS TO VALUESFIELD WITH
VALUESFIELD[X]
;X=[0 TO 3]

= W0

ONE OF THE CONSTANTS IS
STORED

EM
KFIELD

VALUESFIELD
K+10

CONSTANT TO BE LOADED IF X=0

K+1
K$ABC
K-100000

CONSTANT TO BE LOADED IF X=3

ENDK

Access to Constants Fields is checked in the same way as write access to indexed operands. This is
why X may only assume positive values from 0 to "Length of Constants Field -1".

3.18 Program Structures

A program is split up into program sequences so as to make it clearer. To do this the programmer
uses jump labels (LBL) and conditional and unconditional jumps.
When structured instructions are used, the jump labels and jump commands are created by the
Compiler. Remember that internal jump labels are generated to implement these structured
commands, so the total number of available jump labels will be reduced accordingly. Structured
instructions can be nested to up to 16 levels but there must be no "interleaving".

Right:

IFT

Wrong: IFT

...

...

WHILEF

WHILEF

...

...

ENDW

END

...

...

ENDI

ENDW

Instructions IFT, IFF, WHILET, WHILEF, ENDW, UNTILT and UNTILF require a valid gating result in
the Logic Accumulator. They terminate the gating chain.
Instructions ELSE, ENDI and REPEAT require all gating chains to be terminated first.