2 goto and if-goto commands, Conditional if-goto – Rockwell Automation 8520-GUM 9/Series CNC Grinder Operation and Programming Manual Documentation Set User Manual

Page 653

Advertising
background image

Paramacros

Chapter 20

20-9

Unconditional GOTO

Use the unconditional GOTO command to automatically transfer control
any time that the GOTO block is executed.

The format for the GOTO command is:

GOTO n;

Where:

Specifies:

n

the sequence number of the block to which execution is transferred when the
GOTO block is executed.

Example 20.7

Un-conditional GOTO

N1...;

N2...;

N3GOTO5;

N4...;

N5...;

N6...;

/N7GOTO1;

In Example 20.7, execution continues sequentially until block N3 is read.
Execution then transfers to block N5 and again resumes sequential
execution to block N6. If optional block skip 1 is off, block N7 transfers
execution back to block N1.

Conditional IF-GOTO

The conditional IF-GOTO command is dependent on whether a
mathematical condition is true. If the condition is true, execution transfers
to the block specified.

Format for the IF-GOTO command is:

IF [(condition)] GOTO n;

Where:

Specifies:

(condition)

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

n

the block to which execution is transferred if the condition is tested as true.

If the condition is tested as false, execution falls through the block and the
GOTO is not executed. Program execution continues in a normal fashion.

20.2.2
GOTO and IF-GOTO
Commands

Advertising