I am trying to control a linear drive motor with a built-in encoder. I am using a motor driver to move the linear motor. I have calculated a PWM signal for a PWM frequency of 1kHz and a duty percent of 50% with the following values:
Now I am struggling to comprehend how you control the speed of the motor and how do you control when it is moving and when it is not. Could anyone give me some starting points please?
- Internal Clock = 180 MHz
- Prescaler = 180
- Arr register (calculated) 1MHz
- CCRx = 500
C:
TIM1->CCR1 = 500;
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
Now I am struggling to comprehend how you control the speed of the motor and how do you control when it is moving and when it is not. Could anyone give me some starting points please?