AnsweredAssumed Answered

Bi-Directional Motor Control using PWM in STM32F1

Question asked by Mor.Keyshav on Mar 27, 2017

Hello everyone,

I am trying to reverse the motor direction using PWM from the STM32F1 Series controller and using the L293D Motor driver. I have referred to the bi-directional motor control circuit given in l293d datasheet and done connections accordingly. The following is a snippet of the code which I have used to try the direction control.

 

Please feel free to point out my mistake.

 

Thanks.

 

HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2);

HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_3);

__HAL_TIM_SetCompare(&htim2,TIM_CHANNEL_2,1000);

__HAL_TIM_SetCompare(&htim2,TIM_CHANNEL_3,0);

HAL_Delay(10000);

__HAL_TIM_SetCompare(&htim2,TIM_CHANNEL_2,0);

__HAL_TIM_SetCompare(&htim2,TIM_CHANNEL_3,1000);

HAL_Delay(10000);

Outcomes