Intro to MCode 1: Basic Motion CommandsTutorial overviewThis tutorial covers the basic variables and instructions impacting motion. What you need:
Variables
Commands
Motion variables MCode motion variables
The relationship between VI, VM, A and D is shown in the motion profile diagram on the right. The following details the sequence of events when a motion command is given.
The relationship of MS (Microstep resolution select) and the motion variables
As shown in the table, the settings for a particular velocity profile can change dramaticall based on the microstep resolution setting
Move to Relative Position (MR)Move to a relative position (MR) A move relative (MR) moves an offset distance (motor steps) from the current position. In the case of the profile shown above the end position of the first move will be 1 + 2, or 0 + 51200. Position will be 51200 steps from 0. The second move of +51200 steps will end at position 3 or 51200 steps from position 2. The third MR will index the axis 153600 steps in the negative direction from position 3. Note that if the position counter is read using PR P, the counter will read in steps from 0 or -51200.
Move to Absolute Position (MA)Move to an Absolute Position (MA) A move absolute (MA) moves a distance (motor steps) from the 0. In the case of the profile shown above the end position of the first move will be 1 + 2, or 0 + 51200. Position will be 51200 steps from 0. The second move of +51200 steps will end at position 3 or 102400 steps from position 2. The third MA will index the axis 153600 steps in the negative direction from position 3, with a final position of -51200 absolute from 0.
Slew at velocity (SL)Slew at velocity (SL) Slew (SL) is used to index the axis at a constant velocity. The motor will continue to slew at commanded velocity until an SL 0, or escape is commanded. Note that SL will function independant of the VM setting. If a velocity greater than VM is commanded the motor will accelerate to the commanded velocity, ignoring the setting of VM.
Using an encoderUsing an encoder If the encoder is enabled the move commands use different values. The encoder has 1000 lines and yields 4000 counts or counts per revolution, as shown in the diagram at right. Therefore, the MR and MA command values are programmed in encoder counts. One full revolution would be programmed as MR or MA 4000. When the encoder is enabled, the MS value is defaulted to 256. Knowing these factors you can program a multitude of different movements, speeds, and time intervals. The default values for the motion variables is now used in encoder counts with the following values:
Encoder related variables and commands Note that when the Lexium MDrive is in an hMTechnology mode (AS=1, 2 or 3) the encoder functions become irrelevant.
|
|||||||||||||||||||||||||||||||||||
|