Ranbeer Singh
Full Member level 5
- Joined
- Jul 30, 2015
- Messages
- 259
- Helped
- 22
- Reputation
- 44
- Reaction score
- 22
- Trophy points
- 1,298
- Location
- Faridabad India
- Activity points
- 3,266
Hello
I was tring to make over current protection codes in microcontroller.
When Current_ADC value reach more than 2.0 it will make PWM_On_Time = 0 and Current_ADC will be 0 also. In second loop Current_ADC will be less than 2.0 because at this time motor is in off mode. So it will go in else condition and will ON to motor again. Thus it will do like ON-OFF-ON-OFF-ON-OFF (motor will sound like ghid ghid ghid.....).
Motor will vibrate at this condition. how can i avoid to this error?
I am thinking a solution by reducing PWM_On_Time value one by one at list current more then 2.0A. But it will go again in else condition and motor will vibrate too.
I was tring to make over current protection codes in microcontroller.
Code:
while(1){
if(Current_ADC>2.0) PWM_On_Time = 0;
else{ PWM_On_Time = ADC_Value/4.031;}
}
When Current_ADC value reach more than 2.0 it will make PWM_On_Time = 0 and Current_ADC will be 0 also. In second loop Current_ADC will be less than 2.0 because at this time motor is in off mode. So it will go in else condition and will ON to motor again. Thus it will do like ON-OFF-ON-OFF-ON-OFF (motor will sound like ghid ghid ghid.....).
Motor will vibrate at this condition. how can i avoid to this error?
I am thinking a solution by reducing PWM_On_Time value one by one at list current more then 2.0A. But it will go again in else condition and motor will vibrate too.