
7 Operation
104
Version: 1.2.1
MS249E
C-863.12 Mercury Controller
Example: Moving an axis with a variable travel distance back and forth
INFORMATION
When macros are recorded on the
Controller macros
tab in PIMikroMove, the
MAC BEG
and
MAC END
commands must be left out.
The axis 1 is to move back and forth. The travel to the left and to the right is to be variably
adjustable without having to change the used macros. Local and global variables are therefore
used.
1.
Create the global variables LEFT and RIGHT by sending:
VAR LEFT 5
VAR RIGHT 15
LEFT therefore has the value 5, and RIGHT has the value 15. These values can be
changed at any time, e.g., by sending the
VAR
command again.
−
Create the global variables again each time the C-863.12 is switched on or
rebooted, since they are only written to the volatile memory of the C-863.12.
2.
Record the MOVLR macro by sending:
MAC BEG movlr
MAC START movwai ${LEFT}
MAC START movwai ${RIGHT}
MAC END
MOVLR successively starts the MOVWAI macro (which is still to be recorded) for both
directions of motion. The values of the global variables LEFT and RIGHT are used when
MOVWAI is started, to set the value of the local variable 1 contained in MOVWAI (dollar
signs and braces are necessary for the local variable 1 in the macro to actually be
replaced by the
value
of the global variable and not by its
name
).
3.
Record the MOVWAI macro by sending:
MAC BEG movwai
MOV 1 $1
WAC ONT? 1 = 1
MAC END
MOVWAI moves axis 1 to the target position which is specified by the value of the local
variable 1 and waits until the axis has reached the target position.
4.
Run the MOVLR macro by sending:
MAC NSTART movlr 5
The MOVLR macro is executed five times in succession, i.e., axis 1 alternately moves to
the positions 5 and 15 five times. You can also select any other value for the number of
executions.