31
Math Functions
Another powerful feature of the MDrive Motion Control is its ability to perform common math functions and to use these to
manipulate data.
Addition .................................................................... K2
†
=P+R2
Subtraction ................................................................. K3
†
=R1-P
Multiplication .............................................................. A=A*2
Division ......................................................................... A=A/2
†
User-defined variable used as an example.
Motion Commands
MA
Move to an absolute position relative to a defined zero position.
For example, type the following commands followed by hitting enter:
P=0
MA 20000
H
PR P
The terminal screen will read 20000
MA 3000
H
PR P
The screen will echo back 3000.
MR
Move number of steps indicated relative to current position.
For example, type the following commands followed by hitting enter:
P=0
MR 20000
H
PR P
The terminal screen will read 20000
MR 3000
H
PR P
Notice the position echoed is 23000 and not 3000.
SL
Move at a constant velocity.
SLEW 200000
The motor will move at a constant velocity 200000 steps per second.
H
An H (hold) should typically follow any MA or MR commands in a program so that program execution is suspended until motion
is complete.
(Note: There are circumstances where you may not want to hold up program execution.)
Below is a usage example.
PG 100 ‘enter program mode at address 100
LB M1 ‘label program M1
MR 20000 ‘set motion mode to relative, move relative 20000 steps
H ‘hold until motion completes
-20000 ‘move relative -20000 steps
H ‘hold until motion completes
E ‘end program
PG ‘exit program mode