3 while ... endw structure 7-129, 4 case branch 7-129, 3 while ... endw structure – HEIDENHAIN TNC 407 (243 020) Technical Manual User Manual
Page 590: 4 case branch

3.18.3 WHILE ... ENDW Structure
The WHILE ... ENDW structure repeats a program sequence if 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:
•
WHILET
(While True)
Execute sequence if Logic Accumulator=1
•
WHILEF
(While False)
Execute sequence if Logic Accumulator=0
•
ENDW
(End While)
End of program sequence, go back to beginning
A WHILE ... ENDW loop is only run when the WHILE condition is fulfilled at the beginning. The
execution condition must be repeated before the ENDW instruction. The condition can also be
repeated differently than before the WHILE instruction!
Example:
.....
L
M100
;create condition for 1st WHILE scan
WHILET
;execute following code if Logic Accumulator = 1
.....
;code to be executed
L
M101
;create condition for repeat processing
A
M102
;next condition
ENDW
;return to WHILE scan
Two internal jump labels are generated for the WHILE ... ENDW structure.
3.18.4 CASE Branch
Indexed Module Call (CASE)
Abbreviation for PLC Editor:
CASE (CASE OF)
Byte
Word
Execution time [
µ
s]
3.3 to 3.8
3.3 to 3.8
Number of bytes
46
44
4 bytes must be added to the length for each entry in the jump table (CM).
Operands: B, W
Operation:
The CASE command is used to select a defined subprogram from a list of module calls (CM). These
CM commands come directly after the CASE command and are numbered internally in ascending
order from 0 to 127 maximum. The content of the operand (B, W) addresses the desired module.