Intelligent Motion Systems 17 manual R i v e M o t i o n C o n t r o l P r o g r a m m i n g

Page 31

M D r i v e M o t i o n C o n t r o l P r o g r a m m i n g

The MDrive programming language consists of simple 1-2 character mnemonics.

O p e r a t i o n a l M o d e s

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.

B a s i c C o m p o n e n t s o f M D r i v e M o t i o n C o n t r o l S o f t w a r e

I n s t r u c t i o n s

An instruction results in an action, there are three types:

M o t i o n

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.

P r o g r a m

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.

S y s t e m

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.

V a r i a b l e s

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.

F a c t o r y D e f i n e d Va r i a b l e s

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.

U s e r D e f i n e d Va r i a b l e s

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.

29

Image 31
Contents Operating Instructions Intelligent Motion Systems, Inc All Rights Reserved Table of Contents List of Figures Part 1 General Information and Hardware Specifications Intentionally Left Blank A t u r e S u m m a r y Control Knob LMAX2 T a r y M o t o r Specification sC t i o n O v e r v i e w Standard Rotary Motor LmaxMDI1715 N e a r M o t o r Specification sMDI1719 E e d F o r c e C u r v e 2 4 V D C MDI17 Linear ActuatorE e d F o r c e C u r v e 4 5 V D C R i v e 1 7 M o t i o n C o n t r o l a C M E S c r e w N e r a l Specification sMDI17 Acme Screws W e r S u p p l y R e q u i r e m e n t s E r m a l Specification sC o m m e n d e d I M S P o w e r S u p p l i e s A t u r e S u m m a r y MDI2218 MDrive23 Motion Control SpecificationsMDI2231 MDI2222Refer to .10 for screw pitch information MDI23 Linear ActuatorMDI23 Acme Screws R i v e 2 3 M o t i o n C o n t r o l a C M E S c r e wIP404MDI23 Page Intentionally Left Blank C o m m e n d e d W i r i n g Connector P1Y o u t a n d I n t e r f a c e G u i d e l i n e s N C o n f i g u r a t i o n a n d D e s c r i p t i o n sN g l e M D r i v e Connector P2 10 Pin HeaderT e r f a c i n g P o w e r T e r f a c i n g R S 4 8 5 C o m m u n i c a t i o n sRS-485 Interface, Multiple MDrive Motion Control System Input Functions T e r f a c i n g t h e D i g i t a l I / OE s o f t h e D i g i t a l I / O T e r f a c i n g I n p u t sTruth Table I/O Used as a Group TTL Interface to Input GroupT e r f a c i n g a S i n g l e O u t p u t E x a m p l e s T e r f a c i n g O u t p u t sM p l e U s a g e T e r f a c i n g t h e a n a l o g I n p u tInstallation Install i n g a n d U s i n g I M S Te r m i n a lS t e m R e q u i r e m e n t s I n g t h e I M S Te r m i n a l S o f t w a r e 13 IMS Terminal Upgrader Window R i a b l e s R i v e M o t i o n C o n t r o l P r o g r a m m i n gE r a t i o n a l M o d e s S t r u c t i o n sY w o r d s A g sT i o n C o m m a n d s T h F u n c t i o n sC o m m a n d s Read IO1 Setup PR S1 Read IO2 Setup PR S2Please Note Any program labeled SU will execute on power-up VAR CT Baud Mnemonic Function Unit Range Syntax ExampleI n s t r u c t i o n s , Va r i a b l e s a n d F l a g s T h e m a t i c a l F u n c t i o n s Symbol FunctionAcceleration Motion Variable Baud Rate Setup VariableRetrieve All Parameters Variable Busy Flag Read Only Motion Flag Branch Program InstructionCall Subroutine Program Instruction Set Counter 2 Encoder Counts Motion VariableClear Program Program Instruction D1-D5 Digital Input Filtering Variable Set Encoder Deadband Setup VariableDeceleration Motion Variable Device Name Setup Variable Drive Enable Flag Setup FlagEnd Program Execution Program Instruction Echo Mode Flag Setup Flag Encoder Enable Flag Setup FlagRead-Only Error Flag Status Flag Execute Program Program Instruction Error Number Variable Status VariableHold Current Setup Variable Home to Index Mark Variable Setup VariableHold Program Execution Program Instruction Hold Current Delay Time Setup Variable Home to Home Switch Variable Setup VariableRead Input Variable Read Encoder Index Mark Variable Read Analog Input VariableIncrement Variable Program Instruction Read Inputs 1-4 As 1 Value Variable Joystick Enable Flag Setup FlagInitialize Parameters Instruction List Program Space Instruction Lock User Program Setup FlagLabel Program/Subroutine Instruction Move To Relative Position Motion Instruction Motion InstructionPR MS Microstep Resolution Motion VariableOn Error Handler Instruction Motor Settling Delay Time Motion VariableO1 O4 Set/Print Output Logic State Variable Set/Print Position Counter Instruction Set Ouputs 1-4 As 1 Value VariableEnter/Exit Program Mode Program Instruction Postition Maintenance Enable Setup FlagPrint Selected Data/Text Instruction Pause Program Instruction Party Mode Enable Flag Setup FlagR1 R4 User Registers User Variable Run Current Setup VariableReturn From Subroutine Instruction Resume Program InstructionSave to EEProm Instruction Set/Print I/O Point Instruction S1 S4 Set/Print I/O Point Type/Active State InstructionEncoder Variable Stall Detection Mode Variable Encoder VariableRead Only Stall Flag Encoder Flag Trip Enable Flag Setup FlagTrip on Input Variable Trip on Position Variable Upgrade Firmware InstructionRead User Variables Create User Variable Name Instruction Read Only Velocity Variable Motion VariableRead Only Firmware Version Factory Variable Appendix a Program Errors Error Code FaultErrors Data ErrorsTWENTY-FOUR Month Limited Warranty Western Region