Conditional if-goto – Rockwell Automation 8520 9/Series CNC Lathe User Manual

Page 683

Advertising
background image

Paramacros

Chapter 28

28-9

Example 28.7

Unconditional GOTO

N1...;

N2...;

N3GOTO5;

N4...;

N5...;

N6...;

/N7GOTO1;

In Example 28.7, execution continues sequentially until block N3 is read;

then execution transfers to block N5 and again resumes sequential

execution to block N6. If optional block skip 1 is off, block N7 will

transfer execution back to block N1.

Conditional IF-GOTO

The conditional IF-GOTO command is dependent on whether a

mathematical condition is true. If this condition is true, execution will

transfer to the block specified.

Use this format for the IF-GOTO command:

IF [(condition)] GOTO n;

Where :

Is :

(condition)

some mathematical condition. This condition is tested by the control to determine if

it is true or false.

n

if the condition is tested as true, execution is transferred to the block specified as n

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.

Example 28.8

Conditional IF

N1...;

N2IF[#3EQ-1.5]GOTO5;

N3...;

N4...;

N5...;

N6IF[#4LT3]GOTO1;

N7...;

Advertising