Rockwell Automation 8520 9/Series CNC Lathe User Manual

Page 685

Advertising
background image

Paramacros

Chapter 28

28-11

Use this format for the WHILE-DO-END command:

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

Where :

Is :

(condition)

some mathematical condition. 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 as it is for 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 then transferred to the block immediately following the END statement

block.

Example 28.9

WHILE-DO-END Program Segment

N1 #1=1;

N2WHILE[#1LT10]DO1

N3#1=[#1+1];

N4...;

N5...;

N6END1;

N7...;

In Example 28.9, blocks N2 through N6 are executed 9 times. At that

time, the condition in block N2 becomes false, and program execution is

transferred to block N7.

Nesting is possible with a WHILE-DO-END command. Nesting is defined

here as one WHILE-DO-END program segment executing within another

WHILE-DO-END program segment. WHILE-DO-END nesting is limited

to 3 independent segments at one time.

Advertising