In this How-to guide, we will explain how to execute an oscillation movement by directly changing the register values, instead of using MotionLab or the dedicated macros for motion.
We will consider an oscillation movement in either position, velocity or torque mode.
Changing registers can be done in motion lab, by using macros, or externally by using for example CAN-communication. This HowTo 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.
- 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 cyclic synchronous position/velocity/torque mode:
First, the movement should be prepared, meaning all the relevant parameters should be set:
- Set modes of operation to Cyclic synchronous position/velocity/torque mode -> register 0x6060 value to 8/9/10
- Make sure the command reference source is set to Internal generator -> register 0x2430 value is 6.
- Set the function type: register 0x2436 subindex 0x01
- Set the amplitude: register 0x2436 subindex 0x02
- Set the frequency: register 0x2436 subindex 0x03
Execute the movement
Starting the movement
Now that all the parameters are set correctly, and as a difference from the profile position mode, there is no need to change the controlword (register 0x6040) to perform the motion. For more information about the control word, see 'Controlword in cyclic synchronous position/velocity/torque mode' explanation:
Most important steps here are:
Now that the movement has started, we need to monitor the statusword bit. To see if the drive follows the command value, see 'Statusword in cyclic synchronous position/velocity/torque mode' explanation:
If the drive is following the target value, then the 12th bit of the statusword will have a value of 1.
Serial code example
Steps to be done to be able to manually a sine oscillation of 10000 counts of amplitude and 5Hz of frequency:
Set modes of operation to cyclic synchronous position mode
Write in modes of operation (0x6060) a value of 8
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 command source to the internal generator
Write in the internal generator cmd source (0x2430) a value of 6
Set the function type as sinusoidal
Write the function type (0x2436, subindex 0x01) a value of 0
Set the amplitude to 10000c
Write the amplitude (0x2436, subindex 0x02) a value of 10000
Set the frequency to 5Hz
Write the frequency (0x2436, subindex 0x03) a value of 500
w 0x6060 8
w 0x6040 6
w 0x6040 7
w 0x6040 15
w 0x2430 6
w 0x012436 0
w 0x022436 10000
w 0x032436 500