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 #29 background imageLoading...
Page #29 background image
Parker Hannifin
By using parentheses, you can change the order of operations in an
expression. That is, operations in parentheses are performed first,
then operations outside the parentheses. For example, the
expression
(2 + 6 / 3) * 5 - 9
results in an answer of 11, while the expression
(2 + 6 / 3) * (5 - 9)
results in -16 as the answer.
Nested Parentheses
You can also embed parentheses, where operations in the deepest
parentheses are performed first. For example, the expression
((7 + 3) / 2) * 3
contains embedded parentheses. From the example, the first
operation is 7+3, the second operation is 10/2, and the third
operation is 5*3, which results in 15 as the answer.
Examples
The following demonstrate some simple uses of expressions. The
examples assume memory space is allocated for the variables.
Example 1
The following causes axis X to move position to the resulting value of
the expression.
X(P0 + P2 * P30)
Example 2
When the following IF statement proves true, the message “OK”
prints.
IF(P0=1234) THEN PRINT “ok”
Example 3
The following concatenates strings $V1 and $V2, and sets string $V0
equal to the result.
$V0 = $V1 + $V2
Example 4
The following program generates a random number from 0 to 999.
As the program loops, it counts each loop. When the number equals
123, the program exits the loop and prints the count.
PROGRAM
DIM LV(2) : REM dimension 2 long variables
LV0=0 : REM set LV0 equal to 0
_LOOP1
LV1=RND(1000) : REM set LV1 equal to random number
LV0=LV0+1 : REM increment LV0 with each loop
IF (LV1<>123) THEN GOTO LOOP1
PRINT “Done in”;lv0;”tries”
ENDP
Programming Basics 29

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