Conditional while-do-end – Rockwell Automation 8520-GUM 9/Series CNC Grinder Operation and Programming Manual Documentation Set User Manual

Page 655

Advertising
background image

Paramacros

Chapter 20

20-11

All blocks between the DO and the END command are executed
indefinitely or until execution is transferred to some block out of the loop
or stopped by some external operation such as pressing <CYCLE STOP>
or

<E-STOP>

.

Conditional WHILE-DO-END

The conditional WHILE-DO-END command is dependent on whether a
mathematical condition is true. If this condition is false, execution
transfers to the block immediately following the END statement block.

The format for the WHILE-DO-END command is:

WHILE [ (condition) ] DO m;
;
;
;
END m;

Where :

Is :

(condition)

some condition expression (see page 20-7for details). This condition is tested
by the control to determine if it is true or false.

m

an identifier used by the control to relate a DO block with an END block. The
value of m must be the same for the DO and the corresponding END. This value
can be either 1, 2, or 3.

All blocks between the DO and the END command are executed until the
condition is tested as false. This set of blocks is referred to as a
WHILE-DO-END program segment.

When the condition for the WHILE-DO block is tested as false, execution
is transferred to the block immediately following the END statement block.

Example 20.9 illustrates the use of the WHILE-DO-END block.

Example 20.9

WHILE-DO-END Program Segment

N1 #1=1;

N2WHILE[#1LT10]DO1

N3#1=[#1+1];

N4...;

N5...;

N6END1;

N7...;

Advertising