
JRC 2 DIO? 1 = 1
JRC -1 ONT? 1 = 0
CPY TARGET POS? 1
MOV 1 ${TARGET}
VAR TARGET
MAC END
➔
The macro has the same tasks as the HALT macro. However, axis 1 is not stopped by
pushbutton via the
HLT
command; instead the result of the
POS? 1
query is copied to the
TARGET variable. Then this variable is used as the target position for the
MOV
command.
As a result, the axis stays right where it was. To clean up, TARGET is defined as empty
with the
VAR
command which deletes the variable.
5. Start the HALTVAR macro on the controller.
MAC START haltvar
➔
Axis 1 starts to move. It is stopped by switching digital input line 1 to the high state (e. g.
by pushbutton). Error code 10 is not set because no halt or stop command is used.
Example Macro: HID Control Alternating with Relative Motion
The identifier of axis 1 was changed in X with the
SAI command
. The absolute target
position of axis X is to be controlled by axis 1 of the HID (e.g., a joystick axis). The buttons of
a connected C-170.PB pushbutton box are to be used for the following tasks:
■
Button 1: Starting a relative motion in the positive direction when HID control is disabled
■
Button 2: Starting a relative motion in the negative direction when HID control is disabled
■
Button 3: Disabling HID control
■
Button 4: Active HID control
1. Connect C-170.PB pushbutton box from PI to the
I/O socket.
➔
Digital input lines 1 to 4 are switched to high state as long as the respective button is
pressed.
2. Connect C-819.20 or C-819.30 joystick to the
Joystick socket.
➔
For commands, the connected joystick axis is accessible as axis 1 HID 1.
3. Record the STARTUP macro on the controller.
MAC BEG startup
HIN X 0
SVO X 1
FRF X
WAC ONT? X = 1
HIA X 0 0 0
HIA X 1 1 1
HIN X 1
MAC START LOOP
MAC END
The macro has the following tasks:
■
Switch on the servo mode for axis X.
■
Start a reference move for axis X.
■
Configure HID control for axis X: The absolute target position is to be controlled by
axis 1 of HID 1.
■
Activate HID control for axis X
■
Start the LOOP macro for the main loop
4. Record the LOOP macro on the controller.
MAC BEG loop
MAC START button3
MAC START loop
8 E-871.1A1N FUNCTIONS
PZ285EN
‒
1/30/2019
99
M O T I O N | P O S I T I O N I N G