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

Page 654

Advertising
background image

Paramacros

Chapter 20

20-10

Example 20.8 illustrates the use of the conditional IF-GOTO command.

Example 20.8

Conditional IF

N1...;

N2IF[#3EQ-1.5]GOTO5;

N3...;

N4...;

N5...;

N6IF[#4LT3]GOTO1;

N7...;

When block N2 is read, parameter #3 is compared to the value -1.5. If the
comparison is true, blocks N3 and N4 are skipped and execution continues
on from block N5. If the comparison is false, execution continues on to
block N3. When block N6 is read, parameter #4 is compared to the value
3. If the comparison is true, execution is transferred to block N1. If false,
execution continues on to block N7.

Use the DO-END and WHILE-DO-END commands to set up complex
looping structures in your part program. The format for these commands is
shown below.

Unconditional DO-END

The unconditional DO-END command is rarely used. The lack of a
condition here causes the control to loop indefinitely, until you press

<CYCLE STOP> or <E-STOP> or until some other transfer of control

command forces execution out of the loop.

The format for the UNCONDITIONAL DO-END command is:

DO m;
:
:
:
END m;

Where :

Is :

m

an identifier used 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.

20.2.3
DO-END and
WHILE-DO-END Commands

Advertising