How to manually execute a profile velocity movement by using the registers

How to manually execute a profile velocity movement by using the registers

In this How-to guide, we will explain how to execute a movement (profile velocity) by directly changing the register values, instead of using MotionLab or the dedicated macros for motion. 

We will consider a movement towards a specific velocity in this example. 

Changing registers can be done in MotionLab, by using macros, or externally by using for example CAN-communication. This How-To just focusses on the sequence of commands that needs to be done for a movement. 
Changing directly the register values is only recommended for advanced users.

Background reading

  • All the documentation about relevant motion registers can be found in the EMCL documentation: Motion objects
  • The register values are always in counts: position is counts, velocity counts/sec etc. The conversions depend on the resolution, maximum stroke of a motor etc. In general, how to convert units can be found here: EMCL Units
  • A step by step guide explaining how to set up serial commanding: Serial commanding
  • Explanation of profile velocity mode: Profile velocity mode

Prepare the movement

First, the movement should be prepared, meaning all the relevant parameters should be set:

Execute the movement

Starting the movement

Now that all the parameters are set correctly, we can start the movement by changing the controlword (register 0x6040). For more information about the controlword, see 'Controlword in profile velocity mode' explanation: Profile velocity mode
Most important steps here are:
  • Set the driver status to Ready to Switch On -> controlword value to 6
  • Set the driver status to Switch On -> controlword value to 7
  • Set the driver status to Operation Enable -> controlword value to 15
  • The requested target velocity is sent to the motion controller.
  • After the new target velocity has been delivered to the drive, the motion controller does not expect any controlword action more.
  • To change to a new velocity the user only needs to redefine the target velocity register (0x60FF) 

Monitoring movement

Now that the movement has started, we need to monitor the statusword bit. To see if the target is reached, see 'Statusword in profile position mode' explanation: Profile velocity mode
Once the 10th bit (target bit) is 1, the target has been reached (unless a controlled stop is being made by the Halt bit of the control word).

Serial code example

Steps to be done to be able to manually move the motor at a specific velocity: 

  • Set Modes of Operation to Profile Velocity
    Write in Modes of Operation (0x6060) a Value of 3
  • Set the driver status to Ready to Switch On
    Write in the controlword (0x6040) a Shutdown Command (Value 6)
  • Set the driver status to Switch On
    Write in the controlword (0x6040) a Switch on Command (Value 7)
  • Set the driver status to Operation Enable
    Write in the controlword (0x6040) a Switch on Command (Value 15)
  • Set the new Target Velocity
    Write in Target Velocity (0x60FF) the new value (50000)
The movement will be executed using the profile acceleration/deceleration set. The acceleration/deceleration can be changed before changing the 'new set-point' on the controlword.
In code: 
w 0x6060 3
w 0x6040 6
w 0x6040 7
w 0x6040 15
w 0x60FF x (x = your target velocity, in counts/s!)