Parker
Hannifin
Programming Example
The following program creates a square. You can use ACR-View to
set up the controller. Then enter the program into program 0 and
download it to the controller.
RES X Y : REM reset encoder registers to 0 at startup
_LOOP
ACC 50 : REM set trajectory generator acceleration
DEC 50 : REM set trajectory generator deceleration
STP 50 : REM set trajectory generator stop ramp
VEL 5 : REM set target velocity
X5 : REM move axis to position
Y5 : REM move axis to position
X0 : REM move axis to position
Y0 : REM move axis to position
GOTO LOOP
ENDP
Before running the program, make sure you are at the program 0
prompt in the terminal emulator. The
LRUN
command lets you listen
to through a terminal to the
statements and error messages.
This is the only way to view program errors.
►
To run the program, type
LRUN
When ready to exit the listening mode, press the
ESC
key (ASCII 27).
As the program runs, you can pause the program by setting the
Feedhold Request bit or sending the
PAUSE
command. The Feedhold
Request bit stops the axes using the deceleration value.
►
To set the Feedhold Request bit, type
SET 520
.
You can resume the program by setting Cycle Start Request bit or
sending the
RESUME
command. The Cycle Start Request bit starts the
axes using the acceleration value.
►
To set the Cycle Start bit, type
SET 521
.
While the program is in a feedhold, you can check the encoder
position of each axis.
►
To view the axis X encoder position, type
PRINT P6144
.
►
To view the axis Y encoder position, type
?P6160
Parametric Evaluation
Most commands take arguments. Often, those command-line
arguments are literals—values that are interpreted as they are
written. For example, axis numbers, bit index numbers, acceleration
or deceleration speeds, or positional values.
In addition to literals, you can use expressions (also called formulas).
The ACR controller can solve complex integer or floating point math.
To use expressions, you must enclose them in parentheses.
Expressions can use the following:
•
Constants
•
Variables
Programming Basics 27