113
96-8000 Rev AC
May 2010
Programming
WHILE [<conditional expression>] DOn;
<statements>;
ENDn;
This executes the statements between DOn and ENDn as long as the condi
-
tional expression evaluates to True. The brackets in the expression are neces
-
sary. If the expression evaluates to False, then the block after ENDn is ex
-
ecuted next. WHILE can be abbreviated to WH. The DOn-ENDn portion of the
statement is a matched pair. The value of n is 1-3. This means that there can
be no more than three nested loops per subroutine. A good example of how
nesting of WHILE loops can be used is in defining a matrix.
#101= 3;
#102= 4;
G0 X#101 Y4. ;
F2.5;
WH [#101 GT 0] DO1;
#102= 4;
WH [#102 GT 0] DO2;
G81 X#101 Y#102 Z-0.5;
#102= #102 - 1;
END2;
#101= #101 - 1;
END1;
;
M30;
This program drills a 3 x 4 matrix hole pattern.
Although nesting of WHILE statements can only be up to three levels, there
really is no limit since each subroutine can have up to three levels of nesting.
If there is a need to nest to a level greater than 3, then the segment containing
the three lowest levels of nesting can be made into a subroutine thus overcom-
ing the limitation.
If two separate WHILE loops are in a subroutine, they can use the same nest-
ing index. For example:
#3001=0 (WAIT 500 MILLISECONDS);
WH [#3001 LT 500] DO1;
END1;
<Other statements>
#3001=0 (WAIT 300 MILLISECONDS) ;
WH [#3001 LT 300] DO1 ;
END1 ;
You can use GOTO to jump out of a region encompassed by a DO-END, but
you cannot use a GOTO to jump into it. Jumping around inside a DO-END
region using a GOTO is allowed.
An infinite loop can be executed by eliminating the WHILE and expression.
Thus,
Содержание 96-8000
Страница 15: ...6 96 8000 Rev AC May 2010 Mill Warning Decals ...
Страница 16: ...7 96 8000 Rev AC May 2010 Safety Lathe Warning Decals ...
Страница 41: ...32 96 8000 Rev AC May 2010 ...
Страница 93: ...84 96 8000 Rev AC May 2010 ...
Страница 129: ...120 96 8000 Rev AC May 2010 ...
Страница 133: ...124 96 8000 Rev AC May 2010 ...
Страница 268: ......
Страница 269: ......