Intelligent Motion Systems 17 Network Card User Manual


 
29
MDrive Motion Control Programming
The MDrive programming language consists of simple 1-2 character mnemonics.
Operational Modes
There are two operational modes for the MDrive. Immediate and Program:
1] Immediate: Commands are issued and executed directly to the MDrive Motion Control by user entry into the terminal
window.
2] Program: Commands and processes are run from within an MDrive program. This mode is also used for program
entry.
Basic Components of MDrive Motion Control Software
Instructions
An instruction results in an action, there are three types:
Motion
Motion instructions are those that result in the movement of a motor. The syntax of these commands are as such: first type the
command followed by a space, and then the velocity or position data. For example, MA 2000 will move the motor to position 2000.
I/O
An I/O instruction results in the change of parameters or the state of an Input or Output. The syntax of these commands are as
such: first type the command followed by a space, then the I/O #, then an equal sign, then the data. Example: PR I1 will read the
state of input 1, O2=0 will set output 2 to 0.
Program
A program instruction allows program manipulation. The syntax of these vary due to the nature of the command. Some examples
would be as such: PG 100, this command toggles the system into program mode starting at address 100. BR LP, IO 21=1, this
command will Branch to a program labeled LP if I/O 21 is true.
System
A system instruction is an instruction that can only be used in immediate mode to perform a system operation such as program
execution (EX) or listing the contents of program memory (L). For example: EX 100 will execute a program located at line 100 of
program memory space, or EX K1 will execute a program labeled K1.
Variables
Variables are labeled data that allow the user to define or manipulate data. These can also be used with the built-in math functions to
manipulate data. There are two classes of variables: factory defined and user defined. The syntax for each variable may differ. See
Section 6 for usage instructions and examples.
Factory Defined Variables
These variables are predefined at the factory. They cannot be deleted. When an FD (Factory Default) instruction is given, these
variables will be reset to their factory default values. There are two types of factory defined variables. They are:
. Read/Writable: These factory defined variables can have their value altered by the user to effect events inside or
outside of a program. For example, A (Acceleration Variable) can be used to set the Acceleration, or P (Position
Variable) can be used to set a position reference point.
. Read Only: These factory defined variables cannot be manipulated by the user, but contain data that can be
viewed or used to effect events inside a program. For example, V (Velocity Variable) registers the current velocity
of the motor in steps per second.
User Defined Variables
The VA instruction allows the user to assign a 32 bit, 2 character name to a user defined variable.
The restrictions for this command are:
1] A variable cannot be named after an MDrive Motion Control Instruction, Variable or Flag.
2] The first character must be alpha, the second character may be alpha-numeric.
3] A variable is limited to two characters.
With these the user can define a variable to store and retreive data and perform math functions. When the FD (Factory Defaults)
instruction is given, these variables will be deleted! There are two types of user defined variables:
. Global Variables: Global variables are variables that are defined outside of a program. The benefit to using a
global variable is that no user memory is required. For example, the user can define a variable called SP for speed
by entering VA SP into the terminal. The user can then set that variable to equal the value of the read only variable
V (velocity) by entering SP = V into the terminal.
. Local Variables: This type of user defined variable is defined within a program and can only effect events within
that program. It is stored in RAM. Examples of this type of variable will be given later in the section. It is worthy of
note that a local variable is not static, but is erased and declared again each time a program is executed.