EasyManuals Logo

Parker ACR Series Programmer's Guide

Parker ACR Series
176 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #20 background imageLoading...
Page #20 background image
Parker Hannifin
When using an IF/THEN statement, observe the following:
You can nest GOTO and GOSUB statements in an IF/THEN
statement.
Example
The following demonstrates several simple IF/THEN statements.
IF (BIT 24) THEN P0 = P0+1
IF (P0 > 4000) THEN GOSUB 100 : P0 = P0-1
IF/ELSE
The IF/ELSE statement provides a powerful tool for program
branching and program flow control. The IF/ELSE statement allows
you to run one set of code if the condition is true, and another set of
code if the condition is false. The IF/ELSE statement must end with
ENDIF.
When using an IF/ELSE statement, observe the following:
You can nest GOSUB statements in an IF/ELSE statement. The
GOSUB provides a return into the IF/ELSE statement.
Do not nest GOTO statements in IF/ELSE statements. The GOTO
statement exits the IF/ELSE statements, and does not provide
any link back inside.
Do not nest IF/THEN statements in IF/ELSE statements—the logic
may not provide the results you expect.
Tip: When troubleshooting programs, use the LIST command to
view the program stored on the controller. In recognizing
IF/ELSE statements, the controller indents the statements
under the IF including the ENDIF. If any statements in the
IF/ELSE are not indented but should be, check the code in
the program editor and re-download.
Example
The following demonstrates different actions based on conditions
being true or false. If the input (bit 24) is true, the long array
increments and axis X moves an incremental 25 units. If false, the
long array decrements and axis Y moves to absolute position 5.
IF (BIT 24)
LA0(1) = LA0(1)+1
X/25
ELSE
LA0(1) = LA0(1)-1
Y5
ENDIF
20 Programmer’s Guide

Other manuals for Parker ACR Series

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Parker ACR Series and is the answer not in the manual?

Parker ACR Series Specifications

General IconGeneral
BrandParker
ModelACR Series
CategoryController
LanguageEnglish

Related product manuals