| aMotion_SetParameter | Index |
Definition:
| void aMotion_SetParameter( | char channel, char paramIndex, int param); |
Parameters:
| channel | - | Motion control channel. |
| paramIndex | - | Index of motion control parameter. |
| param | - | New parameter. |
Return Value:
Description:
This routine sets a control constant for a motion control channel. See the cmdMO_CFG documentation for details on configuring a motion control channel.
There are defined values for the index of each motion control parameter.
| aMOTION_PARAM_MODE | 0 | Index for mode and flags. |
| aMOTION_PARAM_P | 1 | Index for P constant. |
| aMOTION_PARAM_I | 2 | Index for I constant. |
| aMOTION_PARAM_D | 3 | Index for D constant. |
| aMOTION_PARAM_COFFSET | 4 | Index for control input offset. |
| aMOTION_PARAM_PWMRAIL | 5 | Index for PWM rail. |
| aMOTION_PARAM_PERIOD | 6 | Index for PID loop period. |
| aMOTION_PARAM_LATENCY | 7 | Index for back-EMF latency period. |
| aMOTION_PARAM_PWMFREQ | 8 | Index for PWM frequency. |
Example:
#include <aMotion.tea>
aMotion_SetParameter(0, aMOTION_PARAM_P, 120);
This would set the P constant for motion control channel 0 to 120. Since the lower 5 bits of the P,I,D constants are fractional, this corresponds to a floating point value of 3.75.
#include <aMotion.tea>
aMotion_SetParameter(0, aMOTION_PARAM_LATENCY, 5);
This would set the back-EMF latency constant for motion control channel 0 to 5. This is equivlent to 0.5ms.
Related: