beautypg.com

1 if ... else ... endi structure 7-128, 2 repeat ... until structure 7-128, 1 if ... else ... endi structure – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual

Page 589: 2 repeat ... until structure

background image


7-128

TNC 407/TNC 415/TNC 425

3 Commands

01.98

3.18.1 IF ... ELSE ... ENDI Structure

The IF ... ELSE ... ENDI structure permits the alternative processing of two program branches
depending on the value in the Logic Accumulator. The ELSE branch can be omitted. The following
commands are available:

IFT

(If Logic Accu True)

Following code only if Logic Accumulator=1

IFF

(If Logic Accu False)

Following code only if Logic Accumulator=0

ELSE

(else)

Following code only if IF not fulfilled

ENDI

(End of IF-Structure)

End of IF Structure

Example:

L

I0

IFT

;If Logic Accu=1

....

;Program code for I0 = 1

ELSE

;

can be omitted

....

;Program code for I0 = 0

can be omitted

ENDI

;end of conditional processing

Internal jump labels are generated for the IF and ELSE instructions.

3.18.2 REPEAT ... UNTIL Structure

The REPEAT ... UNTIL structure repeats a program sequence until a condition is fulfilled.
Under no circumstances must this structure wait for an external event in the cyclical PLC program to
happen!

The following commands are available:

REPEAT

(Repeat)

Repeat program sequence from here

UNTILT

(Until True)

Repeat sequence until Logic Accumulator=1

UNTILF

(Until False)

Repeat sequence until Logic Accumulator=0

A REPEAT ... UNTIL loop is always run at least once!

Example:

=

M100

;end of previous chain

REPEAT

;repeat following code

.....

;code to be executed

LX

;load Index Register

>=

K100

;check Index Register

UNTILT

;repeat until X>=100

An internal jump label is generated for the REPEAT ... UNTIL structure.